// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation.  All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------

namespace System.Fabric.Interop
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics.CodeAnalysis;
    using System.Fabric.Common;
    using System.Fabric.Strings;
    using System.Numerics;
    using System.Runtime.InteropServices;
    using SecureString = System.Security.SecureString;

    //// ----------------------------------------------------------------------------
    //// typedefs

    using BOOLEAN = System.SByte;
    using FABRIC_ATOMIC_GROUP_ID = System.Int64;
    using FABRIC_INSTANCE_ID = System.Int64;
    using FABRIC_NODE_INSTANCE_ID = System.UInt64;
    using FABRIC_PARTITION_ID = System.Guid;
    using FABRIC_REPLICA_ID = System.Int64;
    using FABRIC_SEQUENCE_NUMBER = System.Int64;
    using FABRIC_TESTABILITY_OPERATION_ID = System.Guid;
    using FABRIC_HOST_PROCESS_ID = System.Int64;

    [SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1201:ElementsMustAppearInTheCorrectOrder", Justification = "Matches order in IDL.")]
    [SuppressMessage("Microsoft.StyleCop.CSharp.ReadabilityRules", "SA1121:UseBuiltInTypeAlias", Justification = "It is important here to explicitly state the size of integer parameters.")]
    [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:FieldNamesMustNotContainUnderscore", Justification = "Matches names in IDL.")]
    internal static class NativeTypes
    {
        //// ----------------------------------------------------------------------------
        //// Constants

        internal const FABRIC_ATOMIC_GROUP_ID FABRIC_INVALID_ATOMIC_GROUP_ID = -1;
        internal const FABRIC_SEQUENCE_NUMBER FABRIC_INVALID_SEQUENCE_NUMBER = -1;
        internal const FABRIC_SEQUENCE_NUMBER FABRIC_AUTO_SEQUENCE_NUMBER = 0;
        internal const FABRIC_INSTANCE_ID FABRIC_INVALID_INSTANCE_ID = -1;
        internal const FABRIC_NODE_INSTANCE_ID FABRIC_INVALID_NODE_INSTANCE_ID = 0;
        internal const UInt32 FABRIC_INVALID_OPERATION_INDEX = 0xffffffff;
        internal const FABRIC_SEQUENCE_NUMBER FABRIC_IGNORE_SEQUENCE_NUMBER_CHECK = 0;
        internal const UInt32 FABRIC_HEALTH_REPORT_INFINITE_TTL = 0;
        internal const string FABRIC_SECURITY_ROLE_NAME_AUTHENTICATED_USERS = "Authenticated Users";
        internal const string FABRIC_SECURITY_ROLE_NAME_ADMINISTRATOR = "Administrator";
        internal const UInt32 FABRIC_INFINITE_DURATION = 0xffffffff;

        private static readonly byte[] EmptyByteArray = new byte[0];
        private static readonly NativeFILETIME MinNativeFILETIME = new NativeFILETIME();

        //// ----------------------------------------------------------------------------
        //// Enumerations

        [Guid("4e9e4fc0-39dd-4ac6-9a46-9b5ad0c47b6c")]
        internal enum FABRIC_ERROR_CODE : uint
        {
            // Common HRESULT codes from http://msdn.microsoft.com/en-us/library/aa378137(VS.85).aspx
            S_OK = 0x00000000,
            E_ABORT = 0x80004004,
            E_ACCESSDENIED = 0x80070005,
            E_FAIL = 0x80004005,
            E_HANDLE = 0x80070006,
            E_INVALIDARG = 0x80070057,
            E_NOINTERFACE = 0x80004002,
            E_NOTIMPL = 0x80004001,
            E_OUTOFMEMORY = 0x8007000E,
            E_POINTER = 0x80004003,
            E_UNEXPECTED = 0x8000FFFF,

            // HRESULT codes from win32 errors
            E_FILE_EXISTS = 0x80070050,          // HRESULT_FROM_WIN32(ERROR_FILE_EXISTS)
            E_DIR_NOT_EMPTY = 0x80070091,        //  HRESULT_FROM_WIN32(ERROR_DIR_NOT_EMPTY)
            E_NOT_FOUND = 0x80070490,            //  HRESULT_FROM_WIN32(ERROR_NOT_FOUND)

            // HRESULT values of Exceptions which are not in coreCLR

            // HRESULT value for DuplicateWaitObjectException taken from https://msdn.microsoft.com/en-us/library/system.duplicatewaitobjectexception(v=vs.110).aspx
            COR_E_DUPLICATEWAITOBJECT = 0x80131529,
            // HRESULT value for TypeLoadException taken from https://msdn.microsoft.com/en-us/library/system.typeloadexception(v=vs.110).aspx
            COR_E_TYPELOAD = 0x80131522,

            // Fabric codes
            FABRIC_E_FIRST_RESERVED_ERROR_CODE = 0x80071bbc,
            FABRIC_E_LAST_RESERVED_ERROR_CODE = 0x80071d4b,

            FABRIC_E_COMMUNICATION_ERROR = FABRIC_E_FIRST_RESERVED_ERROR_CODE,
            FABRIC_E_INVALID_ADDRESS,
            FABRIC_E_INVALID_NAME_URI,
            FABRIC_E_INVALID_PARTITION_KEY,
            FABRIC_E_NAME_ALREADY_EXISTS,
            FABRIC_E_NAME_DOES_NOT_EXIST,
            FABRIC_E_NAME_NOT_EMPTY,
            FABRIC_E_NODE_NOT_FOUND,
            FABRIC_E_NODE_IS_UP,
            FABRIC_E_NO_WRITE_QUORUM,
            FABRIC_E_NOT_PRIMARY,
            FABRIC_E_NOT_READY,
            FABRIC_E_OPERATION_NOT_COMPLETE,
            FABRIC_E_PROPERTY_DOES_NOT_EXIST,
            FABRIC_E_RECONFIGURATION_PENDING,
            FABRIC_E_REPLICATION_QUEUE_FULL,
            FABRIC_E_SERVICE_ALREADY_EXISTS,
            FABRIC_E_SERVICE_DOES_NOT_EXIST,
            FABRIC_E_SERVICE_OFFLINE,
            FABRIC_E_SERVICE_METADATA_MISMATCH,
            FABRIC_E_SERVICE_AFFINITY_CHAIN_NOT_SUPPORTED,
            FABRIC_E_SERVICE_TYPE_ALREADY_REGISTERED,
            FABRIC_E_SERVICE_TYPE_NOT_REGISTERED,
            FABRIC_E_VALUE_TOO_LARGE,
            FABRIC_E_VALUE_EMPTY,
            FABRIC_E_PROPERTY_CHECK_FAILED,
            FABRIC_E_WRITE_CONFLICT,
            FABRIC_E_ENUMERATION_COMPLETED,
            FABRIC_E_APPLICATION_TYPE_PROVISION_IN_PROGRESS,
            FABRIC_E_APPLICATION_TYPE_ALREADY_EXISTS,
            FABRIC_E_APPLICATION_TYPE_NOT_FOUND,
            FABRIC_E_APPLICATION_TYPE_IN_USE,
            FABRIC_E_APPLICATION_ALREADY_EXISTS,
            FABRIC_E_APPLICATION_NOT_FOUND,
            FABRIC_E_APPLICATION_UPGRADE_IN_PROGRESS,
            FABRIC_E_APPLICATION_UPGRADE_VALIDATION_ERROR,
            FABRIC_E_SERVICE_TYPE_NOT_FOUND,
            FABRIC_E_SERVICE_TYPE_MISMATCH,
            FABRIC_E_SERVICE_TYPE_TEMPLATE_NOT_FOUND,
            FABRIC_E_CONFIGURATION_SECTION_NOT_FOUND,
            FABRIC_E_CONFIGURATION_PARAMETER_NOT_FOUND,
            FABRIC_E_INVALID_CONFIGURATION,
            FABRIC_E_IMAGEBUILDER_VALIDATION_ERROR,
            FABRIC_E_PARTITION_NOT_FOUND,
            FABRIC_E_REPLICA_DOES_NOT_EXIST,
            FABRIC_E_SERVICE_GROUP_ALREADY_EXISTS,
            FABRIC_E_SERVICE_GROUP_DOES_NOT_EXIST,
            FABRIC_E_PROCESS_DEACTIVATED,
            FABRIC_E_PROCESS_ABORTED,
            FABRIC_E_UPGRADE_FAILED,
            FABRIC_E_INVALID_CREDENTIAL_TYPE,
            FABRIC_E_INVALID_X509_FIND_TYPE,
            FABRIC_E_INVALID_X509_STORE_LOCATION,
            FABRIC_E_INVALID_X509_STORE_NAME,
            FABRIC_E_INVALID_X509_THUMBPRINT,
            FABRIC_E_INVALID_PROTECTION_LEVEL,
            FABRIC_E_INVALID_X509_STORE,
            FABRIC_E_INVALID_SUBJECT_NAME,
            FABRIC_E_INVALID_ALLOWED_COMMON_NAME_LIST,
            FABRIC_E_INVALID_CREDENTIALS,
            FABRIC_E_DECRYPTION_FAILED,
            FABRIC_E_CONFIGURATION_PACKAGE_NOT_FOUND,
            FABRIC_E_DATA_PACKAGE_NOT_FOUND,
            FABRIC_E_CODE_PACKAGE_NOT_FOUND,
            FABRIC_E_SERVICE_ENDPOINT_RESOURCE_NOT_FOUND,
            FABRIC_E_INVALID_OPERATION,
            FABRIC_E_OBJECT_CLOSED,
            FABRIC_E_TIMEOUT,
            FABRIC_E_FILE_NOT_FOUND,
            FABRIC_E_DIRECTORY_NOT_FOUND,
            FABRIC_E_INVALID_DIRECTORY,
            FABRIC_E_PATH_TOO_LONG,
            FABRIC_E_IMAGESTORE_IOERROR,
            FABRIC_E_CORRUPTED_IMAGE_STORE_OBJECT_FOUND,
            FABRIC_E_APPLICATION_NOT_UPGRADING,
            FABRIC_E_APPLICATION_ALREADY_IN_TARGET_VERSION,
            FABRIC_E_IMAGEBUILDER_UNEXPECTED_ERROR,
            FABRIC_E_FABRIC_VERSION_NOT_FOUND,
            FABRIC_E_FABRIC_VERSION_IN_USE,
            FABRIC_E_FABRIC_VERSION_ALREADY_EXISTS,
            FABRIC_E_FABRIC_ALREADY_IN_TARGET_VERSION,
            FABRIC_E_FABRIC_NOT_UPGRADING,
            FABRIC_E_FABRIC_UPGRADE_IN_PROGRESS,
            FABRIC_E_FABRIC_UPGRADE_VALIDATION_ERROR,
            FABRIC_E_HEALTH_MAX_REPORTS_REACHED,
            FABRIC_E_HEALTH_STALE_REPORT,
            FABRIC_E_KEY_TOO_LARGE,
            FABRIC_E_KEY_NOT_FOUND,
            FABRIC_E_SEQUENCE_NUMBER_CHECK_FAILED,
            FABRIC_E_ENCRYPTION_FAILED,
            FABRIC_E_INVALID_ATOMIC_GROUP,
            FABRIC_E_HEALTH_ENTITY_NOT_FOUND,
            FABRIC_E_SERVICE_MANIFEST_NOT_FOUND,
            FABRIC_E_RELIABLE_SESSION_TRANSPORT_STARTUP_FAILURE,
            FABRIC_E_RELIABLE_SESSION_ALREADY_EXISTS,
            FABRIC_E_RELIABLE_SESSION_CANNOT_CONNECT,
            FABRIC_E_RELIABLE_SESSION_MANAGER_EXISTS,
            FABRIC_E_RELIABLE_SESSION_REJECTED,
            FABRIC_E_RELIABLE_SESSION_MANAGER_ALREADY_LISTENING,
            FABRIC_E_RELIABLE_SESSION_MANAGER_NOT_FOUND,
            FABRIC_E_RELIABLE_SESSION_MANAGER_NOT_LISTENING,
            FABRIC_E_INVALID_SERVICE_TYPE,
            FABRIC_E_IMAGEBUILDER_TIMEOUT,
            FABRIC_E_IMAGEBUILDER_ACCESS_DENIED,
            FABRIC_E_IMAGEBUILDER_INVALID_MSI_FILE,
            FABRIC_E_SERVICE_TOO_BUSY,
            FABRIC_E_TRANSACTION_NOT_ACTIVE,
            FABRIC_E_REPAIR_TASK_ALREADY_EXISTS,
            FABRIC_E_REPAIR_TASK_NOT_FOUND,
            FABRIC_E_RELIABLE_SESSION_NOT_FOUND,
            FABRIC_E_RELIABLE_SESSION_QUEUE_EMPTY,
            FABRIC_E_RELIABLE_SESSION_QUOTA_EXCEEDED,
            FABRIC_E_RELIABLE_SESSION_SERVICE_FAULTED,
            FABRIC_E_RELIABLE_SESSION_INVALID_TARGET_PARTITION,
            FABRIC_E_TRANSACTION_TOO_LARGE,
            FABRIC_E_REPLICATION_OPERATION_TOO_LARGE,
            FABRIC_E_INSTANCE_ID_MISMATCH,
            FABRIC_E_UPGRADE_DOMAIN_ALREADY_COMPLETED,
            FABRIC_E_NODE_HAS_NOT_STOPPED_YET,
            FABRIC_E_INSUFFICIENT_CLUSTER_CAPACITY,
            FABRIC_E_INVALID_PACKAGE_SHARING_POLICY,
            FABRIC_E_PREDEPLOYMENT_NOT_ALLOWED,

            /// <summary>
            /// Invalid backup setting. E.g. incremental backup option is not set upfront etc.
            /// </summary>
            FABRIC_E_INVALID_BACKUP_SETTING,

            /// <summary>
            /// Incremental backups can only be done after an initial full backup.
            /// </summary>
            FABRIC_E_MISSING_FULL_BACKUP,

            /// <summary>
            /// A backup is currently in progress.
            /// </summary>
            FABRIC_E_BACKUP_IN_PROGRESS,

            FABRIC_E_DUPLICATE_SERVICE_NOTIFICATION_FILTER_NAME,
            FABRIC_E_INVALID_REPLICA_OPERATION,
            FABRIC_E_INVALID_REPLICA_STATE,
            FABRIC_E_LOADBALANCER_NOT_READY,
            FABRIC_E_INVALID_PARTITION_OPERATION,
            FABRIC_E_PRIMARY_ALREADY_EXISTS,
            FABRIC_E_SECONDARY_ALREADY_EXISTS,

            /// <summary>
            /// The backup directory is not empty.
            /// </summary>
            FABRIC_E_BACKUP_DIRECTORY_NOT_EMPTY,

            FABRIC_E_FORCE_NOT_SUPPORTED_FOR_REPLICA_OPERATION,

            FABRIC_E_ACQUIRE_FILE_LOCK_FAILED,

            FABRIC_E_CONNECTION_DENIED,
            FABRIC_E_SERVER_AUTHENTICATION_FAILED,

            FABRIC_E_CONSTRAINT_KEY_UNDEFINED,
            FABRIC_E_MULTITHREADED_TRANSACTIONS_NOT_ALLOWED,

            FABRIC_E_INVALID_X509_NAME_LIST,

            FABRIC_E_VERBOSE_FM_PLACEMENT_HEALTH_REPORTING_REQUIRED,

            FABRIC_E_GATEWAY_NOT_REACHABLE,

            FABRIC_E_USER_ROLE_CLIENT_CERTIFICATE_NOT_CONFIGURED,

            FABRIC_E_TRANSACTION_ABORTED,

            FABRIC_E_CANNOT_CONNECT,

            FABRIC_E_MESSAGE_TOO_LARGE,

            FABRIC_E_CONSTRAINT_NOT_SATISFIED,

            FABRIC_E_ENDPOINT_NOT_FOUND,

            FABRIC_E_APPLICATION_UPDATE_IN_PROGRESS,

            /// <summary>
            /// Deletion of backup files/directory failed. Currently this can happen
            /// in a scenario where backup is used mainly to truncate logs.
            /// </summary>
            FABRIC_E_DELETE_BACKUP_FILE_FAILED,

            FABRIC_E_CONNECTION_CLOSED_BY_REMOTE_END,

            FABRIC_E_INVALID_TEST_COMMAND_STATE,

            FABRIC_E_TEST_COMMAND_OPERATION_ID_ALREADY_EXISTS,

            FABRIC_E_CM_OPERATION_FAILED,

            FABRIC_E_IMAGEBUILDER_RESERVED_DIRECTORY_ERROR,

            FABRIC_E_CERTIFICATE_NOT_FOUND,

            FABRIC_E_CHAOS_ALREADY_RUNNING,

            FABRIC_E_FABRIC_DATA_ROOT_NOT_FOUND,

            FABRIC_E_INVALID_RESTORE_DATA,

            FABRIC_E_DUPLICATE_BACKUPS,

            FABRIC_E_INVALID_BACKUP_CHAIN,

            FABRIC_E_STOP_IN_PROGRESS,

            FABRIC_E_ALREADY_STOPPED,

            FABRIC_E_NODE_IS_DOWN,

            FABRIC_E_NODE_TRANSITION_IN_PROGRESS,

            FABRIC_E_INVALID_BACKUP,

            FABRIC_E_INVALID_INSTANCE_ID,

            FABRIC_E_INVALID_DURATION,

            FABRIC_E_RESTORE_SAFE_CHECK_FAILED,

            FABRIC_E_CONFIG_UPGRADE_FAILED,

            FABRIC_E_UPLOAD_SESSION_RANGE_NOT_SATISFIABLE,

            FABRIC_E_UPLOAD_SESSION_ID_CONFLICT,

            FABRIC_E_INVALID_PARTITION_SELECTOR,

            FABRIC_E_INVALID_REPLICA_SELECTOR,

            FABRIC_E_DNS_SERVICE_NOT_FOUND,

            FABRIC_E_INVALID_DNS_NAME,

            FABRIC_E_DNS_NAME_IN_USE,

            FABRIC_E_COMPOSE_DEPLOYMENT_ALREADY_EXISTS,

            FABRIC_E_COMPOSE_DEPLOYMENT_NOT_FOUND,

            FABRIC_E_INVALID_FOR_STATEFUL_SERVICES,

            FABRIC_E_INVALID_FOR_STATELESS_SERVICES,

            FABRIC_E_ONLY_VALID_FOR_STATEFUL_PERSISTENT_SERVICES,

            FABRIC_E_INVALID_UPLOAD_SESSION_ID,

            FABRIC_E_BACKUP_NOT_ENABLED,

            FABRIC_E_BACKUP_IS_ENABLED,

            FABRIC_E_BACKUP_POLICY_DOES_NOT_EXIST,

            FABRIC_E_BACKUP_POLICY_ALREADY_EXISTS,

            FABRIC_E_RESTORE_IN_PROGRESS,

            FABRIC_E_RESTORE_SOURCE_TARGET_PARTITION_MISMATCH,

            FABRIC_E_FAULT_ANALYSIS_SERVICE_NOT_ENABLED,

            FABRIC_E_CONTAINER_NOT_FOUND,

            FABRIC_E_OBJECT_DISPOSED,

            FABRIC_E_NOT_READABLE,

            FABRIC_E_BACKUPCOPIER_UNEXPECTED_ERROR,

            FABRIC_E_BACKUPCOPIER_TIMEOUT,

            FABRIC_E_BACKUPCOPIER_ACCESS_DENIED,

            FABRIC_E_INVALID_SERVICE_SCALING_POLICY,

            FABRIC_E_SINGLE_INSTANCE_APPLICATION_ALREADY_EXISTS,

            FABRIC_E_SINGLE_INSTANCE_APPLICATION_NOT_FOUND,

            FABRIC_E_VOLUME_ALREADY_EXISTS,

            FABRIC_E_VOLUME_NOT_FOUND,

            FABRIC_E_DATABASE_MIGRATION_IN_PROGRESS,
            
            FABRIC_E_CENTRAL_SECRET_SERVICE_GENERIC,

            FABRIC_E_SECRET_INVALID,

            FABRIC_E_SECRET_VERSION_ALREADY_EXISTS,

            FABRIC_E_SINGLE_INSTANCE_APPLICATION_UPGRADE_IN_PROGRESS,

            FABRIC_E_OPERATION_NOT_SUPPORTED,

            FABRIC_E_COMPOSE_DEPLOYMENT_NOT_UPGRADING,

            FABRIC_E_SECRET_TYPE_CANNOT_BE_CHANGED,

            FABRIC_E_NETWORK_NOT_FOUND,

            FABRIC_E_NETWORK_IN_USE,

            FABRIC_E_LAST_USED_HRESULT = FABRIC_E_NETWORK_IN_USE
        }

        [Guid("e0ed62e6-087b-4ed8-97b7-9f17a90bea75")]
        internal enum FABRIC_CLIENT_ROLE : int
        {
            FABRIC_CLIENT_ROLE_UNKNOWN = 0x0000,
            FABRIC_CLIENT_ROLE_USER = 0x0001,
            FABRIC_CLIENT_ROLE_ADMIN = 0x0002,
        }

        [Guid("ea32667b-dfde-4c26-93f5-97ad58fa8994")]
        internal enum FABRIC_QUERY_SERVICE_STATUS : int
        {
            FABRIC_QUERY_SERVICE_STATUS_UNKNOWN = 0x0000,
            FABRIC_QUERY_SERVICE_STATUS_ACTIVE = 0x0001,
            FABRIC_QUERY_SERVICE_STATUS_UPGRADING = 0x0002,
            FABRIC_QUERY_SERVICE_STATUS_DELETING = 0x0003,
            FABRIC_QUERY_SERVICE_STATUS_CREATING = 0x0004,
            FABRIC_QUERY_SERVICE_STATUS_FAILED = 0x0005,
        }

        [Guid("701a1afd-fb51-422f-8996-5ccc0dddb436")]
        internal enum FABRIC_QUERY_NODE_STATUS : int
        {
            FABRIC_QUERY_NODE_STATUS_INVALID = 0x0000,
            FABRIC_QUERY_NODE_STATUS_UP = 0x0001,
            FABRIC_QUERY_NODE_STATUS_DOWN = 0x0002,
            FABRIC_QUERY_NODE_STATUS_ENABLING = 0x0003,
            FABRIC_QUERY_NODE_STATUS_DISABLING = 0x0004,
            FABRIC_QUERY_NODE_STATUS_DISABLED = 0x0005,
            FABRIC_QUERY_NODE_STATUS_UNKNOWN = 0x0006,
            FABRIC_QUERY_NODE_STATUS_REMOVED = 0x0007,
        }

        [Guid("9d90db40-ada2-4b5c-bab2-a66b8c042e44")]
        internal enum FABRIC_QUERY_NODE_STATUS_FILTER : int
        {
            FABRIC_QUERY_NODE_STATUS_FILTER_DEFAULT = 0x0000,
            FABRIC_QUERY_NODE_STATUS_FILTER_ALL = 0xFFFF,
            FABRIC_QUERY_NODE_STATUS_FILTER_UP = 0x0001,
            FABRIC_QUERY_NODE_STATUS_FILTER_DOWN = 0x0002,
            FABRIC_QUERY_NODE_STATUS_FILTER_ENABLING = 0x0004,
            FABRIC_QUERY_NODE_STATUS_FILTER_DISABLING = 0x0008,
            FABRIC_QUERY_NODE_STATUS_FILTER_DISABLED = 0x0010,
            FABRIC_QUERY_NODE_STATUS_FILTER_UNKNOWN = 0x0020,
            FABRIC_QUERY_NODE_STATUS_FILTER_REMOVED = 0x0040,
        }

        [Guid("f82137c5-ea24-4c1d-88be-8982290d5a2c")]
        internal enum FABRIC_SERVICE_KIND : int
        {
            FABRIC_SERVICE_KIND_INVALID = 0x0000,
            FABRIC_SERVICE_KIND_STATELESS = 0x0001,
            FABRIC_SERVICE_KIND_STATEFUL = 0x0002,
        }

        [Guid("45f1fe1f-bb52-4d15-a87a-da237d68a331")]
        internal enum FABRIC_SERVICE_PARTITION_KIND : int
        {
            FABRIC_SERVICE_PARTITION_KIND_INVALID = 0x0000,
            FABRIC_SERVICE_PARTITION_KIND_SINGLETON = 0x0001,
            FABRIC_SERVICE_PARTITION_KIND_INT64_RANGE = 0x0002,
            FABRIC_SERVICE_PARTITION_KIND_NAMED = 0x0003,
        }

        [Guid("8ed618a3-a6d2-41a9-a54b-9e9c00ce5001")]
        internal enum FABRIC_QUERY_SERVICE_PARTITION_STATUS : int
        {
            FABRIC_QUERY_SERVICE_PARTITION_STATUS_INVALID = 0x0000,
            FABRIC_QUERY_SERVICE_PARTITION_STATUS_READY = 0x0001,
            FABRIC_QUERY_SERVICE_PARTITION_STATUS_NOT_READY = 0x0002,
            FABRIC_QUERY_SERVICE_PARTITION_STATUS_IN_QUORUM_LOSS = 0x0003,
            FABRIC_QUERY_SERVICE_PARTITION_STATUS_RECONFIGURING = 0x0004,
            FABRIC_QUERY_SERVICE_PARTITION_STATUS_DELETING = 0x0005,
        }

        [Guid("ac7c709e-e729-4911-ae47-91d878760988")]
        internal enum FABRIC_QUERY_SERVICE_REPLICA_STATUS : int
        {
            FABRIC_QUERY_SERVICE_REPLICA_STATUS_INVALID = 0x0000,
            FABRIC_QUERY_SERVICE_REPLICA_STATUS_INBUILD = 0x0001,
            FABRIC_QUERY_SERVICE_REPLICA_STATUS_STANDBY = 0x0002,
            FABRIC_QUERY_SERVICE_REPLICA_STATUS_READY = 0x0003,
            FABRIC_QUERY_SERVICE_REPLICA_STATUS_DOWN = 0x0004,
            FABRIC_QUERY_SERVICE_REPLICA_STATUS_DROPPED = 0x0005,
        }

        [Guid("761AB8CD-A82C-4CA5-8BFC-42AF8173A196")]
        internal enum FABRIC_QUERY_SERVICE_OPERATION_NAME : int
        {
            FABRIC_QUERY_SERVICE_OPERATION_NAME_INVALID = 0x0000,
            FABRIC_QUERY_SERVICE_OPERATION_NAME_NONE = 0x0001,
            FABRIC_QUERY_SERVICE_OPERATION_NAME_OPEN = 0x0002,
            FABRIC_QUERY_SERVICE_OPERATION_NAME_CHANGEROLE = 0x0004,
            FABRIC_QUERY_SERVICE_OPERATION_NAME_CLOSE = 0x0008,
            FABRIC_QUERY_SERVICE_OPERATION_NAME_ABORT = 0x0010
        }

        [Guid("51CD7EAC-A64D-4345-8011-D876BB167CB6")]
        internal enum FABRIC_QUERY_REPLICATOR_OPERATION_NAME : int
        {
            FABRIC_QUERY_REPLICATOR_OPERATION_NAME_INVALID = 0x0000,
            FABRIC_QUERY_REPLICATOR_OPERATION_NAME_NONE = 0x0001,
            FABRIC_QUERY_REPLICATOR_OPERATION_NAME_OPEN = 0x0002,
            FABRIC_QUERY_REPLICATOR_OPERATION_NAME_CHANGEROLE = 0x0004,
            FABRIC_QUERY_REPLICATOR_OPERATION_NAME_UPDATEEPOCH = 0x0008,
            FABRIC_QUERY_REPLICATOR_OPERATION_NAME_CLOSE = 0x0010,
            FABRIC_QUERY_REPLICATOR_OPERATION_NAME_ABORT = 0x0020,
            FABRIC_QUERY_REPLICATOR_OPERATION_NAME_ONDATALOSS = 0x0040,
            FABRIC_QUERY_REPLICATOR_OPERATION_NAME_WAITFORCATCHUP = 0x0080,
            FABRIC_QUERY_REPLICATOR_OPERATION_NAME_BUILD = 0x0100
        }

        [Guid("588b449a-2860-4e72-beb0-9c30939b408b")]
        internal enum FABRIC_QUERY_SERVICE_REPLICA_STATUS_FILTER : int
        {
            FABRIC_QUERY_SERVICE_REPLICA_STATUS_FILTER_DEFAULT = 0x0000,
            FABRIC_QUERY_SERVICE_REPLICA_STATUS_FILTER_ALL = 0xFFFF,
            FABRIC_QUERY_SERVICE_REPLICA_STATUS_FILTER_INBUILD = 0x0001,
            FABRIC_QUERY_SERVICE_REPLICA_STATUS_FILTER_STANDBY = 0x0002,
            FABRIC_QUERY_SERVICE_REPLICA_STATUS_FILTER_READY = 0x0004,
            FABRIC_QUERY_SERVICE_REPLICA_STATUS_FILTER_DOWN = 0x0008,
            FABRIC_QUERY_SERVICE_REPLICA_STATUS_FILTER_DROPPED = 0x0010
        }

        [Guid("ab285295-1508-43a3-9b4a-1419025b233d")]
        internal enum FABRIC_CODE_PACKAGE_ENTRY_POINT_KIND : int
        {
            FABRIC_CODE_PACKAGE_ENTRY_POINT_KIND_INVALID = 0x0000,
            FABRIC_CODE_PACKAGE_ENTRY_POINT_KIND_NONE = 0x0001,
            FABRIC_CODE_PACKAGE_ENTRY_POINT_KIND_EXEHOST = 0x0002,
            FABRIC_CODE_PACKAGE_ENTRY_POINT_KIND_DLLHOST = 0x0003,
            FABRIC_CODE_PACKAGE_ENTRY_POINT_KIND_CONTAINERHOST = 0x0004,
        }

        [Guid("66b42d79-ec04-4475-a0e5-3b3cd44bcee0")]
        internal enum FABRIC_EXEHOST_WORKING_FOLDER : int
        {
            FABRIC_EXEHOST_WORKING_FOLDER_INVALID = 0x0000,
            FABRIC_EXEHOST_WORKING_FOLDER_WORK = 0x0001,
            FABRIC_EXEHOST_WORKING_FOLDER_CODE_PACKAGE = 0x0002,
            FABRIC_EXEHOST_WORKING_FOLDER_CODE_BASE = 0x0003,
        }

        [Guid("e604252a-6a47-4dfc-b0f4-f89be3f38431")]
        internal enum FABRIC_DLLHOST_HOSTED_DLL_KIND : int
        {
            FABRIC_DLLHOST_HOSTED_DLL_KIND_INVALID = 0x0000,
            FABRIC_DLLHOST_HOSTED_DLL_KIND_UNMANAGED = 0x0001,
            FABRIC_DLLHOST_HOSTED_DLL_KIND_MANAGED = 0x0002,
        }

        [Guid("ecccd66b-4fd5-44be-b472-17a9d46567e5")]
        internal enum FABRIC_DLLHOST_ISOLATION_POLICY : int
        {
            FABRIC_DLLHOST_ISOLATION_POLICY_INVALID = 0x0000,
            FABRIC_DLLHOST_ISOLATION_POLICY_SHARED_DOMAIN = 0x0001,
            FABRIC_DLLHOST_ISOLATION_POLICY_DEDICATED_DOMAIN = 0x0002,
            FABRIC_DLLHOST_ISOLATION_POLICY_DEDICATED_PROCESS = 0x0003,
        }

        [Guid("2eced350-b498-11e0-aff2-0800200c9a66")]
        internal enum FABRIC_SECURITY_CREDENTIAL_KIND : int
        {
            FABRIC_SECURITY_CREDENTIAL_KIND_NONE = 0x0000,
            FABRIC_SECURITY_CREDENTIAL_KIND_X509 = 0x0001,
            FABRIC_SECURITY_CREDENTIAL_KIND_WINDOWS = 0x0002,
            FABRIC_SECURITY_CREDENTIAL_KIND_CLAIMS = 0x0003,
        }

        [Guid("4e15b6fd-a02d-401c-b711-76a2fb5b21ee")]
        internal enum FABRIC_CLAIMS_RETRIEVAL_METADATA_KIND : int
        {
            FABRIC_CLAIMS_RETRIEVAL_METADATA_KIND_NONE = 0x0000,
            FABRIC_CLAIMS_RETRIEVAL_METADATA_KIND_AAD = 0x0001,
        }

        [Guid("33447cf0-b498-11e0-aff2-0800200c9a66")]
        internal enum FABRIC_PROTECTION_LEVEL : int
        {
            FABRIC_PROTECTION_LEVEL_NONE = 0x0000,
            FABRIC_PROTECTION_LEVEL_SIGN = 0x0001,
            FABRIC_PROTECTION_LEVEL_ENCRYPTANDSIGN = 0x0002,
        }

        [Guid("a8de6110-d28e-11e0-9572-0800200c9a66")]
        internal enum FABRIC_X509_STORE_LOCATION : int
        {
            FABRIC_X509_STORE_LOCATION_INVALID = 0x0000,
            FABRIC_X509_STORE_LOCATION_CURRENTUSER = 0x0001,
            FABRIC_X509_STORE_LOCATION_LOCALMACHINE = 0x0002,
        }

        [Guid("928b8bd0-d28f-11e0-9572-0800200c9a66")]
        internal enum FABRIC_X509_FIND_TYPE : int
        {
            FABRIC_X509_FIND_TYPE_FINDBYTHUMBPRINT = 0x0000,
            FABRIC_X509_FIND_TYPE_FINDBYSUBJECTNAME = 0x0001,
        }

        [Guid("340e2da0-2a40-465b-8611-a9f1e1179169")]
        internal enum FABRIC_SERVICE_LOAD_METRIC_WEIGHT : int
        {
            FABRIC_SERVICE_LOAD_METRIC_WEIGHT_ZERO = 0x0000,
            FABRIC_SERVICE_LOAD_METRIC_WEIGHT_LOW = 0x0001,
            FABRIC_SERVICE_LOAD_METRIC_WEIGHT_MEDIUM = 0x0002,
            FABRIC_SERVICE_LOAD_METRIC_WEIGHT_HIGH = 0x0003,
        }

        [Guid("2a271c69-033e-4e5f-a343-6256da0f0b39")]
        internal enum FABRIC_MOVE_COST : int
        {
            FABRIC_MOVE_COST_ZERO = 0x0000,
            FABRIC_MOVE_COST_LOW = 0x0001,
            FABRIC_MOVE_COST_MEDIUM = 0x0002,
            FABRIC_MOVE_COST_HIGH = 0x0003,
        }

        [Guid("6c1feaf2-24e6-4db4-a474-ab9e724a466c")]
        internal enum FABRIC_SERVICE_PACKAGE_ACTIVATION_MODE : int
        {
            FABRIC_ISOLATION_LEVEL_SHARED_PROCESS = 0x0000,
            FABRIC_ISOLATION_LEVEL_EXCLUSIVE_PROCESS = 0x0001,
        }

        [Guid("4a573e92-2d22-403d-a9da-a29522aff3dc")]
        internal enum FABRIC_SERVICE_CORRELATION_SCHEME : int
        {
            FABRIC_SERVICE_CORRELATION_SCHEME_INVALID = 0x0000,
            FABRIC_SERVICE_CORRELATION_SCHEME_AFFINITY = 0x0001,
            FABRIC_SERVICE_CORRELATION_SCHEME_ALIGNED_AFFINITY = 0x0002,
            FABRIC_SERVICE_CORRELATION_SCHEME_NONALIGNED_AFFINITY = 0x0003,
        }

        [Guid("41e76f51-9f38-4605-b7b6-ec98d7eb0aa2")]
        internal enum FABRIC_SERVICE_PARTITION_ACCESS_STATUS : int
        {
            FABRIC_SERVICE_PARTITION_ACCESS_STATUS_INVALID = 0x0000,
            FABRIC_SERVICE_PARTITION_ACCESS_STATUS_GRANTED = 0x0001,
            FABRIC_SERVICE_PARTITION_ACCESS_STATUS_RECONFIGURATION_PENDING = 0x0002,
            FABRIC_SERVICE_PARTITION_ACCESS_STATUS_NOT_PRIMARY = 0x0003,
            FABRIC_SERVICE_PARTITION_ACCESS_STATUS_NO_WRITE_QUORUM = 0x0004,
        }

        [Guid("e70bda75-c7f0-4205-8f23-f02762062b07")]
        internal enum FABRIC_REPLICA_ROLE : int
        {
            FABRIC_REPLICA_ROLE_UNKNOWN = 0x0000,
            FABRIC_REPLICA_ROLE_NONE = 0x0001,
            FABRIC_REPLICA_ROLE_PRIMARY = 0x0002,
            FABRIC_REPLICA_ROLE_IDLE_SECONDARY = 0x0003,
            FABRIC_REPLICA_ROLE_ACTIVE_SECONDARY = 0x0004
        }

        [Guid("91e7036a-306a-4535-8cee-669109c9e495")]
        internal enum FABRIC_REPLICA_OPEN_MODE : int
        {
            FABRIC_REPLICA_OPEN_MODE_INVALID = 0x0000,
            FABRIC_REPLICA_OPEN_MODE_NEW = 0x0001,
            FABRIC_REPLICA_OPEN_MODE_EXISTING = 0x0002
        }

        [Guid("4a673322-8c60-4192-abc9-07f8ceaa2f1c")]
        internal enum FABRIC_REPLICA_STATUS : int
        {
            FABRIC_REPLICA_STATUS_INVALID = 0x0000,
            FABRIC_REPLICA_STATUS_DOWN = 0x0001,
            FABRIC_REPLICA_STATUS_UP = 0x0002
        }

        [Guid("ad44562d-22e0-4fea-88f1-251f7fba2f06")]
        internal enum FABRIC_OPERATION_TYPE : int
        {
            FABRIC_OPERATION_TYPE_INVALID = 0x0000,
            FABRIC_OPERATION_TYPE_NORMAL = 0x0001,
            FABRIC_OPERATION_TYPE_END_OF_STREAM = 0x0002,

            FABRIC_OPERATION_TYPE_CREATE_ATOMIC_GROUP = 0x0010,
            FABRIC_OPERATION_TYPE_ATOMIC_GROUP_OPERATION = 0x0020,
            FABRIC_OPERATION_TYPE_COMMIT_ATOMIC_GROUP = 0x0040,
            FABRIC_OPERATION_TYPE_ROLLBACK_ATOMIC_GROUP = 0x0080,
            FABRIC_OPERATION_TYPE_HAS_ATOMIC_GROUP_MASK = 0x00F0
        }

        [Guid("4fd80465-7e08-49e9-a7eb-243f8b1f769d")]
        internal enum FABRIC_OPERATION_TYPE_EX : int
        {
            FABRIC_OPERATION_TYPE_EX_INVALID = 0x0000,
            FABRIC_OPERATION_TYPE_EX_COPY = 0x0001,
            FABRIC_OPERATION_TYPE_EX_SINGLE_OPERATION = 0x0002,
            FABRIC_OPERATION_TYPE_EX_CREATE_ATOMIC_GROUP = 0x0004,
            FABRIC_OPERATION_TYPE_EX_REDO = 0x0008,
            FABRIC_OPERATION_TYPE_EX_UNDO = 0x0010,
            FABRIC_OPERATION_TYPE_EX_COMMIT_ATOMIC_GROUP = 0x0020,
            FABRIC_OPERATION_TYPE_EX_ROLLBACK_ATOMIC_GROUP = 0x0040,
            FABRIC_OPERATION_TYPE_EX_ABORT_ATOMIC_GROUP = 0x0080,
            FABRIC_OPERATION_TYPE_EX_REDO_PASS_COMPLETE = 0x0100,
            FABRIC_OPERATION_TYPE_EX_UNDO_PASS_COMPLETE = 0x0200,
            FABRIC_OPERATION_TYPE_EX_END_OF_STREAM = 0x0400,
        }

        [Guid("ed2f0163-ef8e-4021-8975-fac2b340a97b")]
        internal enum FABRIC_REPLICA_SET_QUORUM_MODE : int
        {
            FABRIC_REPLICA_SET_QUORUM_INVALID = 0x0000,
            FABRIC_REPLICA_SET_WRITE_QUORUM = 0x0001,
            FABRIC_REPLICA_SET_QUORUM_ALL = 0x0002
        }

        [Guid("64764AFA-5126-4306-A164-FABEAA4D967D")]
        internal enum FABRIC_REPLICATOR_SETTINGS_FLAGS : int
        {
            REPLICATOR_SETTING_NONE = 0x0000,
            REPLICATOR_ADDRESS = 0x0001,
            FABRIC_REPLICATOR_SECURITY = 0x0002,
            FABRIC_REPLICATOR_RETRY_INTERVAL = 0x0004,
            FABRIC_REPLICATOR_BATCH_ACKNOWLEDGEMENT_INTERVAL = 0x0008,
            FABRIC_REPLICATOR_REQUIRE_SERVICE_ACK = 0x0010,
            FABRIC_REPLICATOR_REPLICATION_QUEUE_INITIAL_SIZE = 0x0020,
            FABRIC_REPLICATOR_REPLICATION_QUEUE_MAX_SIZE = 0x0040,
            FABRIC_REPLICATOR_COPY_QUEUE_INITIAL_SIZE = 0x0080,
            FABRIC_REPLICATOR_COPY_QUEUE_MAX_SIZE = 0x0100,
            FABRIC_REPLICATOR_REPLICATION_QUEUE_MAX_MEMORY_SIZE = 0x0200,
            FABRIC_REPLICATOR_SECONDARY_CLEAR_ACKNOWLEDGED_OPERATIONS = 0x0400,
            FABRIC_REPLICATOR_REPLICATION_MESSAGE_MAX_SIZE = 0x800,
            FABRIC_REPLICATOR_USE_STREAMFAULTS_AND_ENDOFSTREAM_OPERATIONACK = 0x1000,
            FABRIC_REPLICATOR_SECONDARY_REPLICATION_QUEUE_INITIAL_SIZE = 0x2000,
            FABRIC_REPLICATOR_SECONDARY_REPLICATION_QUEUE_MAX_SIZE = 0x4000,
            FABRIC_REPLICATOR_SECONDARY_REPLICATION_QUEUE_MAX_MEMORY_SIZE = 0x8000,
            FABRIC_REPLICATOR_PRIMARY_REPLICATION_QUEUE_INITIAL_SIZE = 0x10000,
            FABRIC_REPLICATOR_PRIMARY_REPLICATION_QUEUE_MAX_SIZE = 0x20000,
            FABRIC_REPLICATOR_PRIMARY_REPLICATION_QUEUE_MAX_MEMORY_SIZE = 0x40000,
            FABRIC_REPLICATOR_PRIMARY_WAIT_FOR_PENDING_QUORUMS_TIMEOUT = 0x80000,
            FABRIC_REPLICATOR_LISTEN_ADDRESS = 0x100000,
            FABRIC_REPLICATOR_PUBLISH_ADDRESS = 0x200000
        }

        [Guid("5C6611DA-C443-4C4E-A1BB-061B9BD70D85")]
        internal enum FABRIC_FAULT_TYPE : int
        {
            FABRIC_FAULT_TYPE_INVALID = 0x0000,
            FABRIC_FAULT_TYPE_PERMANENT = 0x0001,
            FABRIC_FAULT_TYPE_TRANSIENT = 0x0002,
        }

        [Guid("E1873945-1DC9-44D8-BA96-7C981A909398")]
        internal enum FABRIC_HEALTH_STATE : int
        {
            FABRIC_HEALTH_STATE_INVALID = 0x0000,
            FABRIC_HEALTH_STATE_OK = 0x0001,
            FABRIC_HEALTH_STATE_WARNING = 0x0002,
            FABRIC_HEALTH_STATE_ERROR = 0x0003,
            FABRIC_HEALTH_STATE_UNKNOWN = 0xFFFF
        }

        [Guid("005BF16B-D603-44CE-96B5-3E33F117E0F1")]
        internal enum FABRIC_HEALTH_REPORT_KIND : int
        {
            FABRIC_HEALTH_REPORT_KIND_INVALID = 0x0000,
            FABRIC_HEALTH_REPORT_KIND_STATEFUL_SERVICE_REPLICA = 0x0001,
            FABRIC_HEALTH_REPORT_KIND_STATELESS_SERVICE_INSTANCE = 0x0002,
            FABRIC_HEALTH_REPORT_KIND_PARTITION = 0x0003,
            FABRIC_HEALTH_REPORT_KIND_NODE = 0x0004,
            FABRIC_HEALTH_REPORT_KIND_SERVICE = 0x0005,
            FABRIC_HEALTH_REPORT_KIND_APPLICATION = 0x0006,
            FABRIC_HEALTH_REPORT_KIND_DEPLOYED_APPLICATION = 0x0007,
            FABRIC_HEALTH_REPORT_KIND_DEPLOYED_SERVICE_PACKAGE = 0x0008,
            FABRIC_HEALTH_REPORT_KIND_CLUSTER = 0x0009,
        }

        [Guid("018988E7-8BBD-489F-BEAC-40C40E77B3C4")]
        internal enum FABRIC_HEALTH_ENTITY_KIND
        {
            FABRIC_HEALTH_ENTITY_KIND_INVALID = 0x0000,
            FABRIC_HEALTH_ENTITY_KIND_NODE = 0x0001,
            FABRIC_HEALTH_ENTITY_KIND_PARTITION = 0x0002,
            FABRIC_HEALTH_ENTITY_KIND_SERVICE = 0x0003,
            FABRIC_HEALTH_ENTITY_KIND_APPLICATION = 0x0004,
            FABRIC_HEALTH_ENTITY_KIND_REPLICA = 0x0005,
            FABRIC_HEALTH_ENTITY_KIND_DEPLOYED_APPLICATION = 0x0006,
            FABRIC_HEALTH_ENTITY_KIND_DEPLOYED_SERVICE_PACKAGE = 0x0007,
            FABRIC_HEALTH_ENTITY_KIND_CLUSTER = 0x0008,
        }

        [Guid("fa7ffa7c-f55d-4d20-bfdc-7f2bcb07a0e5")]
        internal enum FABRIC_HEALTH_EVALUATION_KIND : int
        {
            FABRIC_HEALTH_EVALUATION_KIND_INVALID = 0x0000,
            FABRIC_HEALTH_EVALUATION_KIND_EVENT = 0x0001,
            FABRIC_HEALTH_EVALUATION_KIND_REPLICAS = 0x0002,
            FABRIC_HEALTH_EVALUATION_KIND_PARTITIONS = 0x0003,
            FABRIC_HEALTH_EVALUATION_KIND_DEPLOYED_SERVICE_PACKAGES = 0x0004,
            FABRIC_HEALTH_EVALUATION_KIND_DEPLOYED_APPLICATIONS = 0x0005,
            FABRIC_HEALTH_EVALUATION_KIND_SERVICES = 0x0006,
            FABRIC_HEALTH_EVALUATION_KIND_NODES = 0x0007,
            FABRIC_HEALTH_EVALUATION_KIND_APPLICATIONS = 0x0008,
            FABRIC_HEALTH_EVALUATION_KIND_SYSTEM_APPLICATION = 0x0009,
            FABRIC_HEALTH_EVALUATION_KIND_UPGRADE_DOMAIN_DEPLOYED_APPLICATIONS = 0x000A,
            FABRIC_HEALTH_EVALUATION_KIND_UPGRADE_DOMAIN_NODES = 0x000B,
            FABRIC_HEALTH_EVALUATION_KIND_NODE = 0x000C,
            FABRIC_HEALTH_EVALUATION_KIND_REPLICA = 0x000D,
            FABRIC_HEALTH_EVALUATION_KIND_PARTITION = 0x000E,
            FABRIC_HEALTH_EVALUATION_KIND_SERVICE = 0x000F,
            FABRIC_HEALTH_EVALUATION_KIND_DEPLOYED_SERVICE_PACKAGE = 0x0010,
            FABRIC_HEALTH_EVALUATION_KIND_DEPLOYED_APPLICATION = 0x0011,
            FABRIC_HEALTH_EVALUATION_KIND_APPLICATION = 0x0012,
            FABRIC_HEALTH_EVALUATION_KIND_DELTA_NODES_CHECK = 0x0013,
            FABRIC_HEALTH_EVALUATION_KIND_UPGRADE_DOMAIN_DELTA_NODES_CHECK = 0x0014,
            FABRIC_HEALTH_EVALUATION_KIND_APPLICATION_TYPE_APPLICATIONS = 0x0015,
        }

        [Guid("0a87cabd-4b21-40ad-8a6d-3af3d538f1a9")]
        internal enum FABRIC_PROPERTY_TYPE_ID : int
        {
            FABRIC_PROPERTY_TYPE_INVALID = 0x0000,
            FABRIC_PROPERTY_TYPE_BINARY = 0x0001,
            FABRIC_PROPERTY_TYPE_INT64 = 0x0002,
            FABRIC_PROPERTY_TYPE_DOUBLE = 0x0003,
            FABRIC_PROPERTY_TYPE_WSTRING = 0x0004,
            FABRIC_PROPERTY_TYPE_GUID = 0x0005,
        }

        [Guid("0bd919d2-5b30-496e-be32-96a9a42b523f")]
        internal enum FABRIC_PROPERTY_BATCH_OPERATION_KIND : int
        {
            FABRIC_PROPERTY_BATCH_OPERATION_KIND_INVALID = 0x0000,
            FABRIC_PROPERTY_BATCH_OPERATION_KIND_PUT = 0x0001,
            FABRIC_PROPERTY_BATCH_OPERATION_KIND_GET = 0x0002,
            FABRIC_PROPERTY_BATCH_OPERATION_KIND_CHECK_EXISTS = 0x0003,
            FABRIC_PROPERTY_BATCH_OPERATION_KIND_CHECK_SEQUENCE = 0x0004,
            FABRIC_PROPERTY_BATCH_OPERATION_KIND_DELETE = 0x0005,
            FABRIC_PROPERTY_BATCH_OPERATION_KIND_PUT_CUSTOM = 0x0006,
            FABRIC_PROPERTY_BATCH_OPERATION_KIND_CHECK_VALUE = 0x0007,
        }

        [Guid("3e64cc4c-aefe-4f8c-b36a-c23fefadae71")]
        internal enum FABRIC_SERVICE_ENDPOINT_ROLE : int
        {
            FABRIC_SERVICE_ROLE_INVALID = 0x0000,
            FABRIC_SERVICE_ROLE_STATELESS = 0x0001,
            FABRIC_SERVICE_ROLE_STATEFUL_PRIMARY = 0x0002,
            FABRIC_SERVICE_ROLE_STATEFUL_SECONDARY = 0x0003
        }

        [Guid("04727c23-0b95-43c5-bc9c-0ce616fce7fe")]
        internal enum FABRIC_ENUMERATION_STATUS : int
        {
            // Valid status values
            FABRIC_ENUMERATION_INVALID = 0x0000,
            FABRIC_ENUMERATION_BEST_EFFORT_MORE_DATA = 0x0001,
            FABRIC_ENUMERATION_CONSISTENT_MORE_DATA = 0x0002,
            FABRIC_ENUMERATION_BEST_EFFORT_FINISHED = 0x0004,
            FABRIC_ENUMERATION_CONSISTENT_FINISHED = 0x0008,

            // Masks to check for specific conditions
            FABRIC_ENUMERATION_VALID_MASK = 0x000F,
            FABRIC_ENUMERATION_BEST_EFFORT_MASK = 0x0005,
            FABRIC_ENUMERATION_CONSISTENT_MASK = 0x000A,
            FABRIC_ENUMERATION_MORE_DATA_MASK = 0x0003,
            FABRIC_ENUMERATION_FINISHED_MASK = 0x000C,
        }

        [Guid("a83e49c4-8a27-42fa-9335-c0dfe1ce841c")]
        internal enum FABRIC_PARTITION_KEY_TYPE : int
        {
            FABRIC_PARTITION_KEY_TYPE_INVALID = 0x0000,
            FABRIC_PARTITION_KEY_TYPE_NONE = 0x0001,
            FABRIC_PARTITION_KEY_TYPE_INT64 = 0x0002,
            FABRIC_PARTITION_KEY_TYPE_STRING = 0x0003,
        }

        [Guid("bd69ada9-05a1-47fb-873b-a0d69a0ae774")]
        internal enum FABRIC_PARTITION_SCHEME : int
        {
            FABRIC_PARTITION_SCHEME_INVALID = 0x0000,
            FABRIC_PARTITION_SCHEME_SINGLETON = 0x0001,
            FABRIC_PARTITION_SCHEME_UNIFORM_INT64_RANGE = 0x0002,
            FABRIC_PARTITION_SCHEME_NAMED = 0x0003,
        }

        [Guid("fc69c196-8f76-461c-9e5d-bfbe26ed91bc")]
        internal enum FABRIC_SERVICE_DESCRIPTION_KIND : int
        {
            FABRIC_SERVICE_DESCRIPTION_KIND_INVALID = 0x0000,
            FABRIC_SERVICE_DESCRIPTION_KIND_STATELESS = 0x0001,
            FABRIC_SERVICE_DESCRIPTION_KIND_STATEFUL = 0x0002,
        }

        [Guid("33aca70a-7b83-4ba5-b780-3b34bee8c087")]
        internal enum FABRIC_STATEFUL_SERVICE_FAILOVER_SETTINGS_FLAGS : int
        {
            FABRIC_STATEFUL_SERVICE_SETTINGS_NONE = 0x0000,
            FABRIC_STATEFUL_SERVICE_SETTINGS_REPLICA_RESTART_WAIT_DURATION = 0x0001,
            FABRIC_STATEFUL_SERVICE_SETTINGS_QUORUM_LOSS_WAIT_DURATION = 0x0002,
            FABRIC_STATEFUL_SERVICE_SETTINGS_STANDBY_REPLICA_KEEP_DURATION = 0x0004
        }

        [Guid("c8f464e5-bccc-4332-b371-f8acaa75387f")]
        internal enum FABRIC_STATELESS_SERVICE_UPDATE_DESCRIPTION_FLAGS : int
        {
            FABRIC_STATELESS_SERVICE_NONE = 0x0000,
            FABRIC_STATELESS_SERVICE_INSTANCE_COUNT = 0x0001,
            FABRIC_STATELESS_SERVICE_PLACEMENT_CONSTRAINTS = 0x0002,
            FABRIC_STATELESS_SERVICE_POLICY_LIST = 0x0004,
            FABRIC_STATELESS_SERVICE_CORRELATIONS = 0x0008,
            FABRIC_STATELESS_SERVICE_METRICS = 0x0010,
            FABRIC_STATELESS_SERVICE_MOVE_COST = 0x0020,
            FABRIC_STATELESS_SERVICE_SCALING_POLICY = 0x0040
        }

        [Guid("ba531bba-a9c5-40bf-94ed-0aaf61f86add")]
        internal enum FABRIC_STATEFUL_SERVICE_UPDATE_DESCRIPTION_FLAGS : int
        {
            FABRIC_STATEFUL_SERVICE_NONE = 0x0000,
            FABRIC_STATEFUL_SERVICE_TARGET_REPLICA_SET_SIZE = 0x0001,
            FABRIC_STATEFUL_SERVICE_REPLICA_RESTART_WAIT_DURATION = 0x0002,
            FABRIC_STATEFUL_SERVICE_QUORUM_LOSS_WAIT_DURATION = 0x0004,
            FABRIC_STATEFUL_SERVICE_STANDBY_REPLICA_KEEP_DURATION = 0x0008,
            FABRIC_STATEFUL_SERVICE_MIN_REPLICA_SET_SIZE = 0x0010,
            FABRIC_STATEFUL_SERVICE_PLACEMENT_CONSTRAINTS = 0x0020,
            FABRIC_STATEFUL_SERVICE_POLICY_LIST = 0x0040,
            FABRIC_STATEFUL_SERVICE_CORRELATIONS = 0x0080,
            FABRIC_STATEFUL_SERVICE_METRICS = 0x0100,
            FABRIC_STATEFUL_SERVICE_MOVE_COST = 0x0200,
            FABRIC_STATEFUL_SERVICE_SCALING_POLICY = 0x0400
        }

        [Guid("89fee5c1-2016-4e70-9902-d8957f0b8c73")]
        internal enum FABRIC_SERVICE_NOTIFICATION_FILTER_FLAGS : int
        {
            FABRIC_SERVICE_NOTIFICATION_FILTER_FLAGS_NONE = 0x0000,
            FABRIC_SERVICE_NOTIFICATION_FILTER_FLAGS_NAME_PREFIX = 0x0001,
            FABRIC_SERVICE_NOTIFICATION_FILTER_FLAGS_PRIMARY_ONLY = 0x0002,
        }

        [Guid("03b0c355-beb2-47d6-8226-2f3e58cefc05")]
        internal enum FABRIC_APPLICATION_UPGRADE_KIND : int
        {
            FABRIC_APPLICATION_UPGRADE_KIND_INVALID = 0x0000,
            FABRIC_APPLICATION_UPGRADE_KIND_ROLLING = 0x0001,
        }

        [Guid("ddd3239e-b94a-4785-9fdb-c10412bdb0f6")]
        internal enum FABRIC_ROLLING_UPGRADE_MODE : int
        {
            FABRIC_ROLLING_UPGRADE_MODE_INVALID = 0x0000,
            FABRIC_ROLLING_UPGRADE_MODE_UNMONITORED_AUTO = 0x0001,
            FABRIC_ROLLING_UPGRADE_MODE_UNMONITORED_MANUAL = 0x0002,
            FABRIC_ROLLING_UPGRADE_MODE_MONITORED = 0x0003
        }

        [Guid("54947352-4a9c-4a66-a58d-bf64c7e8ebe6")]
        internal enum FABRIC_MONITORED_UPGRADE_FAILURE_ACTION : int
        {
            FABRIC_MONITORED_UPGRADE_FAILURE_ACTION_INVALID = 0x0000,
            FABRIC_MONITORED_UPGRADE_FAILURE_ACTION_ROLLBACK = 0x0001,
            FABRIC_MONITORED_UPGRADE_FAILURE_ACTION_MANUAL = 0x0002
        }

        [Guid("2eaccf3b-ccde-49a5-bb2d-4223eed3cbda")]
        internal enum FABRIC_ROLLING_UPGRADE_UPDATE_FLAGS : int
        {
            FABRIC_ROLLING_UPGRADE_UPDATE_FLAGS_NONE = 0x0000,
            FABRIC_ROLLING_UPGRADE_UPDATE_FLAGS_UPGRADE_MODE = 0x0001,
            FABRIC_ROLLING_UPGRADE_UPDATE_FLAGS_FORCE_RESTART = 0x0002,
            FABRIC_ROLLING_UPGRADE_UPDATE_FLAGS_REPLICA_SET_CHECK_TIMEOUT = 0x0004,
            FABRIC_ROLLING_UPGRADE_UPDATE_FLAGS_FAILURE_ACTION = 0x0008,
            FABRIC_ROLLING_UPGRADE_UPDATE_FLAGS_HEALTH_CHECK_WAIT = 0x0010,
            FABRIC_ROLLING_UPGRADE_UPDATE_FLAGS_HEALTH_CHECK_STABLE = 0x0020,
            FABRIC_ROLLING_UPGRADE_UPDATE_FLAGS_HEALTH_CHECK_RETRY = 0x0040,
            FABRIC_ROLLING_UPGRADE_UPDATE_FLAGS_UPGRADE_TIMEOUT = 0x0080,
            FABRIC_ROLLING_UPGRADE_UPDATE_FLAGS_UPGRADE_DOMAIN_TIMEOUT = 0x0100,
            FABRIC_ROLLING_UPGRADE_UPDATE_FLAGS_HEALTH_POLICY = 0x0200,
            FABRIC_ROLLING_UPGRADE_UPDATE_FLAGS_ENABLE_DELTAS = 0x0400,
            FABRIC_ROLLING_UPGRADE_UPDATE_FLAGS_UPGRADE_HEALTH_POLICY = 0x0800,
            FABRIC_ROLLING_UPGRADE_UPDATE_FLAGS_UPGRADE_APPLICATION_HEALTH_POLICY_MAP = 0x1000,
        }

        [Guid("9626e904-b6dd-4579-98db-8aecc683e0e2")]
        internal enum FABRIC_UPGRADE_KIND : int
        {
            FABRIC_UPGRADE_KIND_INVALID = 0x0000,
            FABRIC_UPGRADE_KIND_ROLLING = 0x0001,
        }

        [Guid("052f0cf1-bff3-44be-92e2-92d2301fbdbd")]
        internal enum FABRIC_APPLICATION_UPGRADE_STATE : int
        {
            FABRIC_APPLICATION_UPGRADE_STATE_INVALID = 0x0000,
            APPLICATION_UPGRADE_STATE_ROLLBACK_IN_PROGRESS = 0x0001,
            APPLICATION_UPGRADE_STATE_ROLLBACK_COMPLETED = 0x0002,
            APPLICATION_UPGRADE_STATE_ROLLFORWARD_PENDING = 0x0003,
            APPLICATION_UPGRADE_STATE_ROLLFORWARD_IN_PROGRESS = 0x0004,
            APPLICATION_UPGRADE_STATE_ROLLFORWARD_COMPLETED = 0x0005,
            APPLICATION_UPGRADE_STATE_FAILED = 0x0006,
            APPLICATION_UPGRADE_STATE_ROLLBACK_PENDING = 0x0007,
        }

        [Guid("f9b0a26f-2ad1-4655-9ea4-cd9096eab03a")]
        internal enum FABRIC_UPGRADE_STATE : int
        {
            FABRIC_UPGRADE_STATE_INVALID = 0x0000,
            FABRIC_UPGRADE_STATE_ROLLBACK_IN_PROGRESS = 0x0001,
            FABRIC_UPGRADE_STATE_ROLLBACK_COMPLETED = 0x0002,
            FABRIC_UPGRADE_STATE_ROLLFORWARD_PENDING = 0x0003,
            FABRIC_UPGRADE_STATE_ROLLFORWARD_IN_PROGRESS = 0x0004,
            FABRIC_UPGRADE_STATE_ROLLFORWARD_COMPLETED = 0x0005,
            FABRIC_UPGRADE_STATE_FAILED = 0x0006,
            FABRIC_UPGRADE_STATE_ROLLBACK_PENDING = 0x0007,
        }

        [Guid("59234fd5-009b-4e8e-a18c-77f4259ff01c")]
        internal enum FABRIC_TEST_COMMAND_PROGRESS_STATE : int
        {
            FABRIC_TEST_COMMAND_PROGRESS_STATE_INVALID = 0x0000,
            FABRIC_TEST_COMMAND_PROGRESS_STATE_RUNNING = 0x0001,
            FABRIC_TEST_COMMAND_PROGRESS_STATE_ROLLING_BACK = 0x0002,
            FABRIC_TEST_COMMAND_PROGRESS_STATE_COMPLETED = 0x0003,
            FABRIC_TEST_COMMAND_PROGRESS_STATE_FAULTED = 0x0004,
            FABRIC_TEST_COMMAND_PROGRESS_STATE_CANCELLED = 0x0005,
            FABRIC_TEST_COMMAND_PROGRESS_STATE_FORCE_CANCELLED = 0x0006,
        }

        [Guid("b7a89e60-1be4-448f-b8a5-3c6736776045")]
        internal enum FABRIC_UPGRADE_DOMAIN_STATE : int
        {
            FABRIC_UPGRADE_DOMAIN_STATE_INVALID = 0x0000,
            FABRIC_UPGRADE_DOMAIN_STATE_PENDING = 0x0001,
            FABRIC_UPGRADE_DOMAIN_STATE_IN_PROGRESS = 0x0002,
            FABRIC_UPGRADE_DOMAIN_STATE_COMPLETED = 0x0003,
        }

        [Guid("97413f36-4b1e-4e3d-9d97-d014097896af")]
        internal enum FABRIC_UPGRADE_FAILURE_REASON : int
        {
            FABRIC_UPGRADE_FAILURE_REASON_NONE = 0x0000,
            FABRIC_UPGRADE_FAILURE_REASON_INTERRUPTED = 0x0001,
            FABRIC_UPGRADE_FAILURE_REASON_HEALTH_CHECK = 0x0002,
            FABRIC_UPGRADE_FAILURE_REASON_UPGRADE_DOMAIN_TIMEOUT = 0x0003,
            FABRIC_UPGRADE_FAILURE_REASON_OVERALL_UPGRADE_TIMEOUT = 0x0004,
            FABRIC_UPGRADE_FAILURE_REASON_PROCESSING_FAILURE = 0x0005,
        }

        [Guid("07dadc06-1e89-4474-96cb-b3dd5195c012")]
        internal enum FABRIC_LOCAL_STORE_KIND : int
        {
            FABRIC_LOCAL_STORE_KIND_INVALID = 0x0000,
            FABRIC_LOCAL_STORE_KIND_ESE = 0x0001,
        }

        [Guid("f81db66c-7c0f-475f-a07b-9e5d1d6b50b3")]
        internal enum FABRIC_SERVICE_REPLICA_KIND : int
        {
            FABRIC_SERVICE_REPLICA_KIND_INVALID = 0x0000,
            FABRIC_SERVICE_REPLICA_KIND_KEY_VALUE_STORE = 0x0001,
        }

        [Guid("5a2a1139-d45c-41a6-92c6-d2daf0fb7f96")]
        internal enum FABRIC_KEY_VALUE_STORE_NOTIFICATION_MODE : int
        {
            FABRIC_KEY_VALUE_STORE_NOTIFICATION_MODE_INVALID = 0x0000,
            FABRIC_KEY_VALUE_STORE_NOTIFICATION_MODE_NONE = 0x0001,
            FABRIC_KEY_VALUE_STORE_NOTIFICATION_MODE_NON_BLOCKING_QUORUM_ACKED = 0x0002,
            FABRIC_KEY_VALUE_STORE_NOTIFICATION_MODE_BLOCK_SECONDARY_ACK = 0x0003,
        }

        [Guid("9881dbc3-fec1-4fe4-a7cd-074f68dc805d")]
        internal enum FABRIC_KEY_VALUE_STORE_FULL_COPY_MODE : int
        {
            FABRIC_KEY_VALUE_STORE_FULL_COPY_MODE_DEFAULT = 0x0000,
            FABRIC_KEY_VALUE_STORE_FULL_COPY_MODE_PHYSICAL = 0x0001,
            FABRIC_KEY_VALUE_STORE_FULL_COPY_MODE_LOGICAL = 0x0002,
            FABRIC_KEY_VALUE_STORE_FULL_COPY_MODE_REBUILD = 0x0003,
        }

        [Guid("a9ede0b4-1602-44e7-be04-0d3ed9ce5595")]
        internal enum FABRIC_TRANSACTION_ISOLATION_LEVEL : int
        {
            FABRIC_TRANSACTION_ISOLATION_LEVEL_DEFAULT = 0x0000,
            FABRIC_TRANSACTION_ISOLATION_LEVEL_READ_UNCOMMITTED = 0x0001,
            FABRIC_TRANSACTION_ISOLATION_LEVEL_READ_COMMITTED = 0x0002,
            FABRIC_TRANSACTION_ISOLATION_LEVEL_REPEATABLE_READ = 0x0003,
            FABRIC_TRANSACTION_ISOLATION_LEVEL_SNAPSHOT = 0x0004,
            FABRIC_TRANSACTION_ISOLATION_LEVEL_SERIALIZABLE = 0x0005,
        }

        [Guid("3831e9cd-efa3-4368-adeb-c69338cbc4bd")]
        internal enum FABRIC_NODE_DEACTIVATION_INTENT : int
        {
            FABRIC_NODE_DEACTIVATION_INTENT_INVALID = 0x0000,
            FABRIC_NODE_DEACTIVATION_INTENT_PAUSE = 0x0001,
            FABRIC_NODE_DEACTIVATION_INTENT_RESTART = 0x0002,
            FABRIC_NODE_DEACTIVATION_INTENT_REMOVE_DATA = 0x0003,
            FABRIC_NODE_DEACTIVATION_INTENT_REMOVE_NODE = 0x0004,
        }

        [Guid("7d2464bb-cefe-4f39-9a0b-fa3d8e1cc348")]
        internal enum FABRIC_APPLICATION_TYPE_STATUS : int
        {
            FABRIC_APPLICATION_TYPE_STATUS_INVALID = 0x0000,
            FABRIC_APPLICATION_TYPE_STATUS_PROVISIONING = 0x0001,
            FABRIC_APPLICATION_TYPE_STATUS_AVAILABLE = 0x0002,
            FABRIC_APPLICATION_TYPE_STATUS_UNPROVISIONING = 0x0003,
            FABRIC_APPLICATION_TYPE_STATUS_FAILED = 0x0004
        }

        [Guid("0b969b49-a278-4aa4-8de2-38a40fbcc701")]
        internal enum FABRIC_APPLICATION_STATUS : int
        {
            FABRIC_APPLICATION_STATUS_INVALID = 0x0000,
            FABRIC_APPLICATION_STATUS_READY = 0x0001,
            FABRIC_APPLICATION_STATUS_UPGRADING = 0x0002,
            FABRIC_APPLICATION_STATUS_CREATING = 0x0003,
            FABRIC_APPLICATION_STATUS_DELETING = 0x0004,
            FABRIC_APPLICATION_STATUS_FAILED = 0x00005
        }

        [Guid("5753c082-9146-4451-9d0b-a6e036263804")]
        internal enum FABRIC_APPLICATION_DEFINITION_KIND : int
        {
            FABRIC_APPLICATION_DEFINITION_KIND_INVALID = 0xFFFF,
            FABRIC_APPLICATION_DEFINITION_KIND_SERVICE_FABRIC_APPLICATION_DESCRIPTION = 0x0000,
            FABRIC_APPLICATION_DEFINITION_KIND_COMPOSE = 0x0001,
            FABRIC_APPLICATION_DEFINITION_KIND_MESH_APPLICATION_DESCRIPTION = 0x0002
        }

        [Guid("dbb93a00-519f-42b9-b443-c7f5e7411afc")]
        internal enum FABRIC_APPLICATION_TYPE_DEFINITION_KIND : int
        {
            FABRIC_APPLICATION_TYPE_DEFINITION_KIND_INVALID = 0x0000,
            FABRIC_APPLICATION_TYPE_DEFINITION_KIND_SERVICE_FABRIC_APPLICATION_PACKAGE = 0x0001,
            FABRIC_APPLICATION_TYPE_DEFINITION_KIND_COMPOSE = 0x0002,
            FABRIC_APPLICATION_TYPE_DEFINITION_KIND_MESH_APPLICATION_DESCRIPTION = 0x0003
        }

        [Guid("96dc9eb4-3e7f-4d6f-81b7-00f2271b298d")]
        internal enum FABRIC_APPLICATION_DEFINITION_KIND_FILTER : int
        {
            FABRIC_APPLICATION_DEFINITION_KIND_FILTER_DEFAULT = 0x0000,
            FABRIC_APPLICATION_DEFINITION_KIND_FILTER_ALL = 0xFFFF,
            FABRIC_APPLICATION_DEFINITION_KIND_FILTER_SERVICE_FABRIC_APPLICATION_DESCRIPTION = 0x0001,
            FABRIC_APPLICATION_DEFINITION_KIND_FILTER_COMPOSE = 0x0002,
            FABRIC_APPLICATION_DEFINITION_KIND_FILTER_MESH_APPLICATION_DESCRIPTION = 0x0004
        }

        [Guid("cd1bf90d-366d-45ba-bdad-7a765063ad88")]
        internal enum FABRIC_APPLICATION_TYPE_DEFINITION_KIND_FILTER : int
        {
            FABRIC_APPLICATION_TYPE_DEFINITION_KIND_FILTER_DEFAULT = 0x0000,
            FABRIC_APPLICATION_TYPE_DEFINITION_KIND_FILTER_ALL = 0xFFFF,
            FABRIC_APPLICATION_TYPE_DEFINITION_KIND_FILTER_SERVICE_FABRIC_APPLICATION_PACKAGE = 0x0001,
            FABRIC_APPLICATION_TYPE_DEFINITION_KIND_FILTER_COMPOSE = 0x0002,
            FABRIC_APPLICATION_TYPE_DEFINITION_KIND_FILTER_MESH_APPLICATION_DESCRIPTION = 0x0004
        }

        [Guid("eb7f2da9-03ec-4ece-b0ef-bf07205d480d")]
        internal enum FABRIC_COMPOSE_DEPLOYMENT_STATUS : int
        {
            FABRIC_COMPOSE_DEPLOYMENT_STATUS_INVALID = 0x0000,
            FABRIC_COMPOSE_DEPLOYMENT_STATUS_PROVISIONING = 0x0001,
            FABRIC_COMPOSE_DEPLOYMENT_STATUS_CREATING = 0x0002,
            FABRIC_COMPOSE_DEPLOYMENT_STATUS_READY = 0x0003,
            FABRIC_COMPOSE_DEPLOYMENT_STATUS_DELETING = 0x0004,
            FABRIC_COMPOSE_DEPLOYMENT_STATUS_UNPROVISIONING = 0x0005,
            FABRIC_COMPOSE_DEPLOYMENT_STATUS_FAILED = 0x0006,
            FABRIC_COMPOSE_DEPLOYMENT_STATUS_UPGRADING = 0x0007
        }

        [Guid("b5f595c8-2ce8-44a6-8611-4decf03a40c0")]
        internal enum FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE : int
        {
            FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_INVALID = 0x0000,
            FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_PROVISIONING_TARGET = 0x0001,
            FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_ROLLING_FORWARD_IN_PROGRESS = 0x0002,
            FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_ROLLING_FORWARD_PENDING = 0x0003,
            FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_UNPROVISIONING_CURRENT = 0x0004,
            FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_ROLLING_FORWARD_COMPLETED = 0x0005,
            FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_ROLLING_BACK_IN_PROGRESS = 0x0006,
            FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_UNPROVISIONING_TARGET = 0x0007,
            FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_ROLLING_BACK_COMPLETED = 0x0008,
            FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_FAILED = 0x0009,
            FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_ROLLING_BACK_PENDING = 0x000A,
        }

        [Guid("d140222b-7d8e-4690-8949-b4b0d423f992")]
        internal enum FABRIC_SERVICE_TYPE_REGISTRATION_STATUS : int
        {
            FABRIC_SERVICE_TYPE_REGISTRATION_STATUS_INVALID = 0x0000,
            FABRIC_SERVICE_TYPE_REGISTRATION_STATUS_DISABLED = 0x0001,
            FABRIC_SERVICE_TYPE_REGISTRATION_STATUS_NOT_REGISTERED = 0x0002,
            FABRIC_SERVICE_TYPE_REGISTRATION_STATUS_REGISTERED = 0x0003
        }

        [Guid("6909C97D-E212-4F28-A615-3BE28A94C150")]
        internal enum FABRIC_DEPLOYMENT_STATUS : int
        {
            FABRIC_DEPLOYMENT_STATUS_INVALID = 0x0000,
            FABRIC_DEPLOYMENT_STATUS_DOWNLOADING = 0x0001,
            FABRIC_DEPLOYMENT_STATUS_ACTIVATING = 0x0002,
            FABRIC_DEPLOYMENT_STATUS_ACTIVE = 0x0003,
            FABRIC_DEPLOYMENT_STATUS_UPGRADING = 0x0004,
            FABRIC_DEPLOYMENT_STATUS_DEACTIVATING = 0x0005,
        }

        [Guid("60C77017-A7F9-4D72-8FDC-C679EA4B71BD")]
        internal enum FABRIC_HOST_TYPE : int
        {
            FABRIC_HOST_TYPE_INVALID = 0x0000,
            FABRIC_HOST_TYPE_EXE_HOST = 0x0001,
            FABRIC_HOST_TYPE_CONTAINER_HOST = 0x0002
        }

        [Guid("E8ED3CF8-FC0D-4C3D-B825-F4687C5BE7E4")]
        internal enum FABRIC_HOST_ISOLATION_MODE : int
        {
            FABRIC_HOST_ISOLATION_MODE_NONE = 0x0000,
            FABRIC_HOST_ISOLATION_MODE_PROCESS = 0x0001,
            FABRIC_HOST_ISOLATION_MODE_HYPER_V = 0x0002
        }

        [Guid("2B7DA3B7-28D2-49A0-BF3B-81BA6C1779F0")]
        internal enum FABRIC_ENTRY_POINT_STATUS : int
        {
            FABRIC_ENTRY_POINT_STATUS_INVALID = 0x0000,
            FABRIC_ENTRY_POINT_STATUS_PENDING = 0x0001,
            FABRIC_ENTRY_POINT_STATUS_STARTING = 0x0002,
            FABRIC_ENTRY_POINT_STATUS_STARTED = 0x0003,
            FABRIC_ENTRY_POINT_STATUS_STOPPING = 0x0004,
            FABRIC_ENTRY_POINT_STATUS_STOPPED = 0x0005,
        }

        [Guid("92574926-8AEB-4DBB-AA17-35F244F98633")]
        internal enum FABRIC_FILE_MODE : uint
        {
            FABRIC_FILE_MODE_INVALID = 0x00000000,
            FABRIC_FILE_MODE_CREATE_NEW = 0x00000001,
            FABRIC_FILE_MODE_CREATE_ALWAYS = 0x00000002,
            FABRIC_FILE_MODE_OPEN_EXISTING = 0x00000003,
            FABRIC_FILE_MODE_OPEN_ALWAYS = 0x00000004,
            FABRIC_FILE_MODE_TRUNCATE_EXISTING = 0x00000005,
        }

        [Guid("A3201B51-74EF-4D3B-AD2D-A68ACE65A2DD")]
        internal enum FABRIC_FILE_ACCESS : uint
        {
            FABRIC_FILE_ACCESS_INVALID = 0x00000000,
            FABRIC_FILE_ACCESS_READ = 0x80000000,
            FABRIC_FILE_ACCESS_WRITE = 0x40000000,
            FABRIC_FILE_ACCESS_READ_WRITE = FABRIC_FILE_ACCESS_READ | FABRIC_FILE_ACCESS_WRITE,
        }

        [Guid("EC05A712-A18A-4A47-B3AF-B6FFDBBAE965")]
        internal enum FABRIC_FILE_SHARE : uint
        {
            FABRIC_FILE_SHARE_INVALID = 0x00000000,
            FABRIC_FILE_SHARE_READ = 0x00000001,
            FABRIC_FILE_SHARE_WRITE = 0x00000002,
            FABRIC_FILE_SHARE_DELETE = 0x00000004,
            FABRIC_FILE_SHARE_READ_WRITE = FABRIC_FILE_SHARE_READ | FABRIC_FILE_SHARE_WRITE,
        }

        [Guid("861BFD99-156F-4947-8652-DC949D8F60A0")]
        internal enum FABRIC_FILE_ATTRIBUTES : uint
        {
            FABRIC_FILE_ATTRIBUTES_NONE = 0x00000000,
            FABRIC_FILE_ATTRIBUTES_READONLY = 0x00000001,
            FABRIC_FILE_ATTRIBUTES_HIDDEN = 0x00000002,
            FABRIC_FILE_ATTRIBUTES_SYSTEM = 0x00000004,
            FABRIC_FILE_ATTRIBUTES_DIRECTORY = 0x00000010,
            FABRIC_FILE_ATTRIBUTES_ARCHIVE = 0x00000020,
            FABRIC_FILE_ATTRIBUTES_DEVICE = 0x00000040,
            FABRIC_FILE_ATTRIBUTES_NORMAL = 0x00000080,
            FABRIC_FILE_ATTRIBUTES_TEMPORARY = 0x00000100,
            FABRIC_FILE_ATTRIBUTES_SPARSE_FILE = 0x00000200,
            FABRIC_FILE_ATTRIBUTES_REPARSE_POINT = 0x00000400,
            FABRIC_FILE_ATTRIBUTES_COMPRESSED = 0x00000800,
            FABRIC_FILE_ATTRIBUTES_OFFLINE = 0x00001000,
            FABRIC_FILE_ATTRIBUTES_NOT_CONTENT_INDEXED = 0x00002000,
            FABRIC_FILE_ATTRIBUTES_ENCRYPTED = 0x00004000,

            FABRIC_FILE_ATTRIBUTES_WRITE_THROUGH = 0x80000000,
            FABRIC_FILE_ATTRIBUTES_OVERLAPPED = 0x40000000,
            FABRIC_FILE_ATTRIBUTES_NO_BUFFERING = 0x20000000,
            FABRIC_FILE_ATTRIBUTES_RANDOM_ACCESS = 0x10000000,
            FABRIC_FILE_ATTRIBUTES_SEQUENTIAL_SCAN = 0x08000000,
            FABRIC_FILE_ATTRIBUTES_DELETE_ON_CLOSE = 0x04000000,
            FABRIC_FILE_ATTRIBUTES_BACKUP_SEMANTICS = 0x02000000,
            FABRIC_FILE_ATTRIBUTES_POSIX_SEMANTICS = 0x01000000,
            FABRIC_FILE_ATTRIBUTES_SESSION_AWARE = 0x00800000,
            FABRIC_FILE_ATTRIBUTES_OPEN_REPARSE_POINT = 0x00200000,
            FABRIC_FILE_ATTRIBUTES_OPEN_NO_RECALL = 0x00100000,
            FABRIC_FILE_ATTRIBUTES_FIRST_PIPE_INSTANCE = 0x00080000,
        }

        [Guid("045b08cd-98b3-4432-b533-575d19848744")]
        internal enum FABRIC_SECURITY_PRINCIPAL_IDENTIFIER_KIND : int
        {
            FABRIC_SECURITY_PRINCIPAL_IDENTIFIER_KIND_INVALID = FABRIC_SECURITY_CREDENTIAL_KIND.FABRIC_SECURITY_CREDENTIAL_KIND_NONE,
            FABRIC_SECURITY_PRINCIPAL_IDENTIFIER_KIND_X509 = FABRIC_SECURITY_CREDENTIAL_KIND.FABRIC_SECURITY_CREDENTIAL_KIND_X509,
            FABRIC_SECURITY_PRINCIPAL_IDENTIFIER_KIND_WINDOWS = FABRIC_SECURITY_CREDENTIAL_KIND.FABRIC_SECURITY_CREDENTIAL_KIND_WINDOWS,
            FABRIC_SECURITY_PRINCIPAL_IDENTIFIER_KIND_CLAIM = FABRIC_SECURITY_CREDENTIAL_KIND.FABRIC_SECURITY_CREDENTIAL_KIND_CLAIMS,
            FABRIC_SECURITY_PRINCIPAL_IDENTIFIER_KIND_ROLE = 0x8000,
        }

        [Guid("0df30b72-d2e6-4975-a0c1-4562f41f8929")]
        internal enum FABRIC_SECURITY_RESOURCE_IDENTIFIER_KIND : int
        {
            FABRIC_SECURITY_RESOURCE_IDENTIFIER_KIND_INVALID = 0x0000,
            FABRIC_SECURITY_RESOURCE_IDENTIFIER_KIND_PATH_IN_FABRIC_IMAGESTORE = 0x0001,
            FABRIC_SECURITY_RESOURCE_IDENTIFIER_KIND_APPLICATION_TYPE = 0x0002,
            FABRIC_SECURITY_RESOURCE_IDENTIFIER_KIND_APPLICATION = 0x0003,
            FABRIC_SECURITY_RESOURCE_IDENTIFIER_KIND_SERVICE = 0x0004,
            FABRIC_SECURITY_RESOURCE_IDENTIFIER_KIND_NAME = 0x0005,
        }

        // The bits in FABRIC_ACCESS_MASK correspond to the Windows ACCESS_MASK's
        // specific, standard access rights bits(bits 0 to 23).
        [Guid("E0A57F77-1CB4-4510-A61C-7CD56230A871")]
        internal enum FABRIC_ACCESS_MASK : int
        {
            FABRIC_ACCESS_MASK_NONE = 0x00000000,
            FABRIC_ACCESS_MASK_CREATE = 0x00000001,
            FABRIC_ACCESS_MASK_WRITE = 0x00000002,
            FABRIC_ACCESS_MASK_READ = 0x00000004,
            FABRIC_STANDARD_RIGHTS_DELETE = 0x00010000,
            FABRIC_STANDARD_RIGHTS_READ_CONTROL = 0x00020000,
            FABRIC_STANDARD_RIGHTS_WRITE_DAC = 0x00040000,
            FABRIC_GENERIC_READ = FABRIC_ACCESS_MASK_READ | FABRIC_STANDARD_RIGHTS_READ_CONTROL,
            FABRIC_GENERIC_WRITE = FABRIC_ACCESS_MASK_CREATE | FABRIC_ACCESS_MASK_WRITE,
            FABRIC_GENERIC_ALL = FABRIC_GENERIC_READ | FABRIC_GENERIC_WRITE | FABRIC_STANDARD_RIGHTS_WRITE_DAC | FABRIC_STANDARD_RIGHTS_DELETE,
        }

        [Guid("04B49B1A-15C7-4381-A450-EAD756B642DF")]
        internal enum FABRIC_SECURITY_ACE_TYPE : int
        {
            FABRIC_SECURITY_ACE_TYPE_INVALID = 0x0000,
            FABRIC_SECURITY_ACE_TYPE_ALLOWED = 0x0001,
        }

        [Guid("C03ADCA5-C6A3-471A-96BB-504979F0E746")]
        internal enum FABRIC_REPAIR_SCOPE_IDENTIFIER_KIND : int
        {
            FABRIC_REPAIR_SCOPE_IDENTIFIER_KIND_INVALID = 0x0000,
            FABRIC_REPAIR_SCOPE_IDENTIFIER_KIND_CLUSTER = 0x0001,
        }

        [Guid("C2500D1F-0AC2-41C2-8F09-C8524EC5EF12")]
        internal enum FABRIC_REPAIR_TARGET_KIND : int
        {
            FABRIC_REPAIR_TARGET_KIND_INVALID = 0x0000,
            FABRIC_REPAIR_TARGET_KIND_NODE = 0x0001,
        }

        [Guid("675A6D45-F38C-46A2-B906-3FE2028ACCC2")]
        internal enum FABRIC_REPAIR_TASK_STATE : int
        {
            FABRIC_REPAIR_TASK_STATE_INVALID = 0x0000,
            FABRIC_REPAIR_TASK_STATE_CREATED = 0x0001,
            FABRIC_REPAIR_TASK_STATE_CLAIMED = 0x0002,
            FABRIC_REPAIR_TASK_STATE_PREPARING = 0x0004,
            FABRIC_REPAIR_TASK_STATE_APPROVED = 0x0008,
            FABRIC_REPAIR_TASK_STATE_EXECUTING = 0x0010,
            FABRIC_REPAIR_TASK_STATE_RESTORING = 0x0020,
            FABRIC_REPAIR_TASK_STATE_COMPLETED = 0x0040,
        }

        /// <summary>
        /// These flags determine which <see cref="System.Fabric.Interop.NativeTypes.FABRIC_REPAIR_TASK_HEALTH_POLICY_UPDATE_DESCRIPTION"/>
        /// should be used while updating the repair task policy.
        /// For each member in <see cref="System.Fabric.Interop.NativeTypes.FABRIC_REPAIR_TASK_HEALTH_POLICY_UPDATE_DESCRIPTION"/> that is
        /// updatable after the repair task is created, there exists a corresponding flag
        /// below. Only if the flag is set, will the member be updated when making the API
        /// call <see cref="System.Fabric.Interop.NativeClient.IFabricRepairManagementClient2.BeginUpdateRepairTaskHealthPolicy"/>.
        /// </summary>
        [Guid("A0C53D2C-58A6-437B-88BD-C5C9742CD22D")]
        internal enum FABRIC_REPAIR_TASK_HEALTH_POLICY_UPDATE_SETTINGS_FLAGS : int
        {
            FABRIC_REPAIR_TASK_HEALTH_POLICY_UPDATE_SETTINGS_NONE = 0x0000,
            FABRIC_REPAIR_TASK_HEALTH_POLICY_UPDATE_SETTINGS_HONOR_PERFORM_PREPARING_HEALTH_CHECK = 0x0001,
            FABRIC_REPAIR_TASK_HEALTH_POLICY_UPDATE_SETTINGS_HONOR_PERFORM_RESTORING_HEALTH_CHECK = 0x0002,
        }

        [Guid("643881FA-6132-4944-ADF8-A18CF3D1E5A9")]
        internal enum FABRIC_REPAIR_TASK_HEALTH_CHECK_STATE : int
        {
            FABRIC_REPAIR_TASK_HEALTH_CHECK_STATE_NOT_STARTED = 0x0000,
            FABRIC_REPAIR_TASK_HEALTH_CHECK_STATE_IN_PROGRESS = 0x0001,
            FABRIC_REPAIR_TASK_HEALTH_CHECK_STATE_SUCCEEDED = 0x0002,
            FABRIC_REPAIR_TASK_HEALTH_CHECK_STATE_SKIPPED = 0x0003,
            FABRIC_REPAIR_TASK_HEALTH_CHECK_STATE_TIMEDOUT = 0x0004,
        }

        [Guid("B4191C93-1175-4100-80F1-B7EDA561311C")]
        internal enum FABRIC_REPAIR_TASK_STATE_FILTER
        {
            FABRIC_REPAIR_TASK_STATE_FILTER_DEFAULT = 0x0000,

            FABRIC_REPAIR_TASK_STATE_FILTER_CREATED = FABRIC_REPAIR_TASK_STATE.FABRIC_REPAIR_TASK_STATE_CREATED,

            FABRIC_REPAIR_TASK_STATE_FILTER_CLAIMED = FABRIC_REPAIR_TASK_STATE.FABRIC_REPAIR_TASK_STATE_CLAIMED,

            FABRIC_REPAIR_TASK_STATE_FILTER_PREPARING = FABRIC_REPAIR_TASK_STATE.FABRIC_REPAIR_TASK_STATE_PREPARING,

            FABRIC_REPAIR_TASK_STATE_FILTER_APPROVED = FABRIC_REPAIR_TASK_STATE.FABRIC_REPAIR_TASK_STATE_APPROVED,

            FABRIC_REPAIR_TASK_STATE_FILTER_EXECUTING = FABRIC_REPAIR_TASK_STATE.FABRIC_REPAIR_TASK_STATE_EXECUTING,

            FABRIC_REPAIR_TASK_STATE_FILTER_RESTORING = FABRIC_REPAIR_TASK_STATE.FABRIC_REPAIR_TASK_STATE_RESTORING,

            FABRIC_REPAIR_TASK_STATE_FILTER_COMPLETED = FABRIC_REPAIR_TASK_STATE.FABRIC_REPAIR_TASK_STATE_COMPLETED,

            FABRIC_REPAIR_TASK_STATE_FILTER_READY_TO_EXECUTE =
                FABRIC_REPAIR_TASK_STATE_FILTER_APPROVED |
                FABRIC_REPAIR_TASK_STATE_FILTER_EXECUTING,

            FABRIC_REPAIR_TASK_STATE_FILTER_ACTIVE =
                FABRIC_REPAIR_TASK_STATE_FILTER_CREATED |
                FABRIC_REPAIR_TASK_STATE_FILTER_CLAIMED |
                FABRIC_REPAIR_TASK_STATE_FILTER_PREPARING |
                FABRIC_REPAIR_TASK_STATE_FILTER_APPROVED |
                FABRIC_REPAIR_TASK_STATE_FILTER_EXECUTING |
                FABRIC_REPAIR_TASK_STATE_FILTER_RESTORING,

            FABRIC_REPAIR_TASK_STATE_FILTER_ALL =
                FABRIC_REPAIR_TASK_STATE_FILTER_ACTIVE |
                FABRIC_REPAIR_TASK_STATE_FILTER_COMPLETED,
        }

        [Guid("B35A5B6B-E2A6-4681-A41E-E560FAA9F1E2")]
        internal enum FABRIC_REPAIR_TASK_FLAGS : int
        {
            FABRIC_REPAIR_TASK_FLAGS_NONE = 0x0000,
            FABRIC_REPAIR_TASK_FLAGS_CANCEL_REQUESTED = 0x0001,
            FABRIC_REPAIR_TASK_FLAGS_ABORT_REQUESTED = 0x0002,
            FABRIC_REPAIR_TASK_FLAGS_FORCED_APPROVAL = 0x0004,
            // Masks
            FABRIC_REPAIR_TASK_FLAGS_VALID_MASK =
                FABRIC_REPAIR_TASK_FLAGS_NONE |
                FABRIC_REPAIR_TASK_FLAGS_CANCEL_REQUESTED |
                FABRIC_REPAIR_TASK_FLAGS_ABORT_REQUESTED |
                FABRIC_REPAIR_TASK_FLAGS_FORCED_APPROVAL,
        }

        [Guid("8ADBC921-D736-4FF5-8148-43FF4A47667C")]
        internal enum FABRIC_REPAIR_IMPACT_KIND : int
        {
            FABRIC_REPAIR_IMPACT_KIND_INVALID = 0x0000,
            FABRIC_REPAIR_IMPACT_KIND_NODE = 0x0001,
        }

        [Guid("BD1702EC-FBB0-468F-8894-F22A84D9B5DE")]
        internal enum FABRIC_REPAIR_NODE_IMPACT_LEVEL : int
        {
            FABRIC_REPAIR_NODE_IMPACT_LEVEL_INVALID = 0x0000,
            FABRIC_REPAIR_NODE_IMPACT_LEVEL_NONE = 0x0001,
            FABRIC_REPAIR_NODE_IMPACT_LEVEL_RESTART = 0x0002,
            FABRIC_REPAIR_NODE_IMPACT_LEVEL_REMOVE_DATA = 0x0003,
            FABRIC_REPAIR_NODE_IMPACT_LEVEL_REMOVE_NODE = 0x0004,
        }

        [Guid("244D5F35-B787-4F89-B71D-422ACC8F8105")]
        internal enum FABRIC_REPAIR_TASK_RESULT : int
        {
            FABRIC_REPAIR_TASK_RESULT_INVALID = 0x0000,
            FABRIC_REPAIR_TASK_RESULT_SUCCEEDED = 0x0001,
            FABRIC_REPAIR_TASK_RESULT_CANCELLED = 0x0002,
            FABRIC_REPAIR_TASK_RESULT_INTERRUPTED = 0x0004,
            FABRIC_REPAIR_TASK_RESULT_FAILED = 0x0008,
            FABRIC_REPAIR_TASK_RESULT_PENDING = 0x0010,
        }

        [Guid("cfaacaf5-18d9-4a73-907e-8dd5230a9e65")]
        internal enum FABRIC_NODE_UPGRADE_PHASE : int
        {
            FABRIC_NODE_UPGRADE_PHASE_INVALID = 0x0000,
            FABRIC_NODE_UPGRADE_PHASE_PRE_UPGRADE_SAFETY_CHECK = 0x0001,
            FABRIC_NODE_UPGRADE_PHASE_UPGRADING = 0x0002,
            FABRIC_NODE_UPGRADE_PHASE_POST_UPGRADE_SAFETY_CHECK = 0x0003
        };

        [Guid("7f7a40fa-cda5-4b87-836c-6fee89ba0257")]
        internal enum FABRIC_UPGRADE_SAFETY_CHECK_KIND : int
        {
            FABRIC_UPGRADE_SAFETY_CHECK_KIND_INVALID = 0x0000,
            FABRIC_UPGRADE_SEED_NODE_SAFETY_CHECK_KIND_ENSURE_QUORUM = 0x0001,
            FABRIC_UPGRADE_PARTITION_SAFETY_CHECK_KIND_ENSURE_QUORUM = 0x0002,
            FABRIC_UPGRADE_PARTITION_SAFETY_CHECK_KIND_WAIT_FOR_PRIMARY_PLACEMENT = 0x0003,
            FABRIC_UPGRADE_PARTITION_SAFETY_CHECK_KIND_WAIT_FOR_PRIMARY_SWAP = 0x0004,
            FABRIC_UPGRADE_PARTITION_SAFETY_CHECK_KIND_WAIT_FOR_RECONFIGURATION = 0x0005,
            FABRIC_UPGRADE_PARTITION_SAFETY_CHECK_KIND_WAIT_FOR_INBUILD_REPLICA = 0x0006,
            FABRIC_UPGRADE_PARTITION_SAFETY_CHECK_KIND_ENSURE_AVAILABILITY = 0x0007,
            FABRIC_UPGRADE_PARTITION_SAFETY_CHECK_KIND_WAIT_FOR_RESOURCE_AVAILABILITY = 0x0008
        };

        [Guid("b524aec6-5410-4b0d-bb12-2c13a426437a")]
        internal enum FABRIC_SAFETY_CHECK_KIND : int
        {
            FABRIC_SAFETY_CHECK_KIND_INVALID = 0x0000,
            FABRIC_SEED_NODE_SAFETY_CHECK_KIND_ENSURE_QUORUM = 0x0001,
            FABRIC_PARTITION_SAFETY_CHECK_KIND_ENSURE_QUORUM = 0x0002,
            FABRIC_PARTITION_SAFETY_CHECK_KIND_WAIT_FOR_PRIMARY_PLACEMENT = 0x0003,
            FABRIC_PARTITION_SAFETY_CHECK_KIND_WAIT_FOR_PRIMARY_SWAP = 0x0004,
            FABRIC_PARTITION_SAFETY_CHECK_KIND_WAIT_FOR_RECONFIGURATION = 0x0005,
            FABRIC_PARTITION_SAFETY_CHECK_KIND_WAIT_FOR_INBUILD_REPLICA = 0x0006,
            FABRIC_PARTITION_SAFETY_CHECK_KIND_ENSURE_AVAILABILITY = 0x0007
        };

        [Guid("3038af2a-63e5-46b2-9c3a-1fcbbdf2aed6")]
        internal enum FABRIC_PACKAGE_SHARING_POLICY_SCOPE : int
        {
            FABRIC_PACKAGE_SHARING_POLICY_SCOPE_NONE = 0x0000,
            FABRIC_PACKAGE_SHARING_POLICY_SCOPE_ALL = 0x0001,
            FABRIC_PACKAGE_SHARING_POLICY_SCOPE_CODE = 0x0002,
            FABRIC_PACKAGE_SHARING_POLICY_SCOPE_CONFIG = 0x0003,
            FABRIC_PACKAGE_SHARING_POLICY_SCOPE_DATA = 0x0004
        };

        /// <summary>
        /// Backup options for the store.
        /// </summary>
        [Guid("8597a0e9-c0d8-4d47-9b68-ff67b1a42c5c")]
        internal enum FABRIC_STORE_BACKUP_OPTION
        {
            /// <summary>
            /// A full backup.
            /// </summary>
            FABRIC_STORE_BACKUP_OPTION_FULL = 0x0001,

            /// <summary>
            /// Incremental backup. i.e. only the changes to the store since the last backup are backed up.
            /// </summary>
            FABRIC_STORE_BACKUP_OPTION_INCREMENTAL = 0x0002,

            /// <summary>
            /// Truncates the transaction logs of the store without creating a folder containing the backed up files.
            /// </summary>
            FABRIC_STORE_BACKUP_OPTION_TRUNCATE_LOGS_ONLY = 0x0003,
        }

        [Guid("8892f30f-588a-4845-9eab-c98c2f4b9e5b")]
        internal enum FABRIC_PARTITION_SELECTOR_TYPE : int
        {
            FABRIC_PARTITION_SELECTOR_TYPE_NONE = 0x0000,
            FABRIC_PARTITION_SELECTOR_TYPE_SINGLETON = 0x0001,
            FABRIC_PARTITION_SELECTOR_TYPE_NAMED = 0x0002,
            FABRIC_PARTITION_SELECTOR_TYPE_UNIFORM_INT64 = 0x0003,
            FABRIC_PARTITION_SELECTOR_TYPE_PARTITION_ID = 0x0004,
            FABRIC_PARTITION_SELECTOR_TYPE_RANDOM = 0x0005,
        }

        [Guid("c2d3fad1-0991-4124-ac19-835ab6d74294")]
        internal enum FABRIC_DATA_LOSS_MODE : int
        {
            FABRIC_DATA_LOSS_MODE_INVALID = 0x0000,
            FABRIC_DATA_LOSS_MODE_PARTIAL = 0x0001,
            FABRIC_DATA_LOSS_MODE_FULL = 0x0002,
        }

        [Guid("10ad1911-2ae2-4d80-af5e-59e54076b885")]
        internal enum FABRIC_QUORUM_LOSS_MODE : int
        {
            FABRIC_QUORUM_LOSS_MODE_INVALID = 0x0000,
            FABRIC_QUORUM_LOSS_MODE_QUORUM_REPLICAS = 0x0001,
            FABRIC_QUORUM_LOSS_MODE_ALL_REPLICAS = 0x0002,
        }

        [Guid("e48fa851-3138-41fa-b46f-6dedad1a86f7")]
        internal enum FABRIC_RESTART_PARTITION_MODE : int
        {
            FABRIC_RESTART_PARTITION_MODE_INVALID = 0x0000,
            FABRIC_RESTART_PARTITION_MODE_ALL_REPLICAS_OR_INSTANCES = 0x0001,
            FABRIC_RESTART_PARTITION_MODE_ONLY_ACTIVE_SECONDARIES = 0x0002,
        }

        [Guid("54D53948-47DC-42C1-8AB6-FFF840F1AE24")]
        internal enum FABRIC_RESTART_NODE_DESCRIPTION_KIND : int
        {
            FABRIC_RESTART_NODE_DESCRIPTION_KIND_INVALID = 0x0000,
            FABRIC_RESTART_NODE_DESCRIPTION_KIND_USING_NODE_NAME = 0x0001,
            FABRIC_RESTART_NODE_DESCRIPTION_KIND_USING_REPLICA_SELECTOR = 0x0002,
        }

        [Guid("E21E8951-4EA0-41E6-8B35-AC53763E271E")]
        internal enum FABRIC_COMPLETION_MODE : int
        {
            FABRIC_COMPLETION_MODE_INVALID = 0x0000,
            FABRIC_COMPLETION_MODE_DO_NOT_VERIFY = 0x0001,
            FABRIC_COMPLETION_MODE_VERIFY = 0x0002,
        }

        [Guid("D50759F6-A96E-4E93-B75F-D9C887FA67BD")]
        internal enum FABRIC_START_NODE_DESCRIPTION_KIND : int
        {
            FABRIC_START_NODE_DESCRIPTION_KIND_INVALID = 0x0000,
            FABRIC_START_NODE_DESCRIPTION_KIND_USING_NODE_NAME = 0x0001,
            FABRIC_START_NODE_DESCRIPTION_KIND_USING_REPLICA_SELECTOR = 0x0002,
        }

        [Guid("65EF158B-605F-4DC5-BC37-1ACCFB0727D1")]
        internal enum FABRIC_STOP_NODE_DESCRIPTION_KIND : int
        {
            FABRIC_STOP_NODE_DESCRIPTION_KIND_INVALID = 0x0000,
            FABRIC_STOP_NODE_DESCRIPTION_KIND_USING_NODE_NAME = 0x0001,
            FABRIC_STOP_NODE_DESCRIPTION_KIND_USING_REPLICA_SELECTOR = 0x0002,
        }

        [Guid("7D829657-0633-4F56-8522-99799CEC2A89")]
        internal enum FABRIC_RESTART_DEPLOYED_CODE_PACKAGE_DESCRIPTION_KIND : int
        {
            FABRIC_RESTART_DEPLOYED_CODE_PACKAGE_DESCRIPTION_KIND_INVALID = 0x0000,
            FABRIC_RESTART_DEPLOYED_CODE_PACKAGE_DESCRIPTION_KIND_USING_NODE_NAME = 0x0001,
            FABRIC_RESTART_DEPLOYED_CODE_PACKAGE_DESCRIPTION_KIND_USING_REPLICA_SELECTOR = 0x0002,
        }

        [Guid("2332816F-CCD1-45E0-A963-FA936B25124E")]
        internal enum FABRIC_MOVE_PRIMARY_DESCRIPTION_KIND : int
        {
            FABRIC_MOVE_PRIMARY_DESCRIPTION_KIND_INVALID = 0x0000,
            FABRIC_MOVE_PRIMARY_DESCRIPTION_KIND_USING_NODE_NAME = 0x0001,
            FABRIC_MOVE_PRIMARY_DESCRIPTION_KIND_USING_REPLICA_SELECTOR = 0x0002,
        }

        [Guid("C095D7A6-F47E-4278-8CB0-397D8F3E0723")]
        internal enum FABRIC_MOVE_SECONDARY_DESCRIPTION_KIND : int
        {
            FABRIC_MOVE_SECONDARY_DESCRIPTION_KIND_INVALID = 0x0000,
            FABRIC_MOVE_SECONDARY_DESCRIPTION_KIND_USING_NODE_NAME = 0x0001,
            FABRIC_MOVE_SECONDARY_DESCRIPTION_KIND_USING_REPLICA_SELECTOR = 0x0002,
        }

        [Guid("62f706f7-d5d4-48f9-9b0d-a7e6fb4ac956")]
        internal enum FABRIC_NODE_TRANSITION_TYPE : int
        {
            FABRIC_NODE_TRANSITION_TYPE_INVALID = 0x0000,
            FABRIC_NODE_TRANSITION_TYPE_START = 0x0001,
            FABRIC_NODE_TRANSITION_TYPE_STOP = 0x0002
        }

        /// <summary>
        /// Falgs for updating application.
        /// </summary>
        [Guid("d74f7718-93bc-4a4d-874a-60869702a3d2")]
        internal enum FABRIC_APPLICATION_UPDATE_DESCRIPTION_FLAGS
        {
            /// <summary>
            /// No update.
            /// </summary>
            FABRIC_APPLICATION_UPDATE_DESCRIPTION_FLAGS_NONE = 0x0000,

            /// <summary>
            /// Update minimum node count.
            /// </summary>
            FABRIC_APPLICATION_UPDATE_DESCRIPTION_FLAGS_MINNODES = 0x0001,

            /// <summary>
            /// Update maximum node count.
            /// </summary>
            FABRIC_APPLICATION_UPDATE_DESCRIPTION_FLAGS_MAXNODES = 0x0002,

            /// <summary>
            /// Update metrics and capacities.
            /// </summary>
            FABRIC_APPLICATION_UPDATE_DESCRIPTION_FLAGS_METRICS = 0x0004
        }

        [Guid("D413EB81-145E-4825-BE02-BC74DF103F61")]
        internal enum FABRIC_CHAOS_STATUS : int
        {
            FABRIC_CHAOS_STATUS_INVALID = 0x0000,
            FABRIC_CHAOS_STATUS_RUNNING = 0x0001,
            FABRIC_CHAOS_STATUS_STOPPED = 0x0002
        }

        [Guid("6c9b5576-6059-454f-92b3-9173dd38954a")]
        internal enum FABRIC_CHAOS_SCHEDULE_STATUS : int
        {
            FABRIC_CHAOS_SCHEDULE_STATUS_INVALID = 0x0000,
            FABRIC_CHAOS_SCHEDULE_STATUS_ACTIVE = 0x0001,
            FABRIC_CHAOS_SCHEDULE_STATUS_EXPIRED = 0x0002,
            FABRIC_CHAOS_SCHEDULE_STATUS_PENDING = 0x0003,
            FABRIC_CHAOS_SCHEDULE_STATUS_STOPPED = 0x0004
        }

        [Guid("583953EF-0968-4917-A62E-F65E9657C0FF")]
        internal enum FABRIC_CHAOS_EVENT_KIND : int
        {
            FABRIC_CHAOS_EVENT_KIND_INVALID           = 0x0000,
            FABRIC_CHAOS_EVENT_KIND_STARTED           = 0x0001,
            FABRIC_CHAOS_EVENT_KIND_EXECUTING_FAULTS  = 0x0002,
            FABRIC_CHAOS_EVENT_KIND_WAITING           = 0x0003,
            FABRIC_CHAOS_EVENT_KIND_VALIDATION_FAILED = 0x0004,
            FABRIC_CHAOS_EVENT_KIND_TEST_ERROR        = 0x0005,
            FABRIC_CHAOS_EVENT_KIND_STOPPED           = 0x0006
        }

        [Guid("BF5D4E3E-4481-4D38-B032-CD02274AE91E")]
        internal enum FABRIC_TEST_ERROR_TYPE : int
        {
            FABRIC_TEST_ERROR_TYPE_INVALID = 0x0000,
            FABRIC_TEST_ERROR_TYPE_FATAL = 0x0001,
            FABRIC_TEST_ERROR_TYPE_TRANSIENT = 0x0002
        }

        [Guid("F089E043-47EC-416A-A649-953157B4875D")]
        internal enum FABRIC_CHAOS_STOP_TYPE : int
        {
            FABRIC_CHAOS_STOP_TYPE_INVALID = 0x0000,
            FABRIC_CHAOS_STOP_TYPE_USER_INITIATED = 0x0001,
            FABRIC_CHAOS_STOP_TYPE_RAN_TO_COMPLETION = 0x0002,
            FABRIC_CHAOS_STOP_TYPE_DUE_TO_TEST_ERROR = 0x0003
        }

        [Guid("21cfaf87-4292-4d31-8a55-78f4be675caf")]
        internal enum FABRIC_RECONFIGURATION_PHASE
        {
            FABRIC_RECONFIGURATION_PHASE_INVALID = 0x0000,
            FABRIC_RECONFIGURATION_PHASE_NONE = 0x0001,
            FABRIC_RECONFIGURATION_PHASE_ZERO = 0x0002,
            FABRIC_RECONFIGURATION_PHASE_ONE = 0x0003,
            FABRIC_RECONFIGURATION_PHASE_TWO = 0x0004,
            FABRIC_RECONFIGURATION_PHASE_THREE = 0x0005,
            FABRIC_RECONFIGURATION_PHASE_FOUR = 0x0006,
            FABRIC_RECONFIGURATION_ABORT_PHASE_ZERO = 0x0007
        }

        [Guid("d7c43265-42f6-42f4-8a71-d692d29daf7f")]
        internal enum FABRIC_RECONFIGURATION_TYPE
        {
            FABRIC_RECONFIGURATION_TYPE_INVALID = 0x0000,
            FABRIC_RECONFIGURATION_TYPE_SWAPPRIMARY = 0x0001,
            FABRIC_RECONFIGURATION_TYPE_FAILOVER = 0x0002,
            FABRIC_RECONFIGURATION_TYPE_OTHER = 0x0003,
            FABRIC_RECONFIGURATION_TYPE_NONE = 0x0004
        }

        [Guid("48e36499-1afb-4e87-b460-e4df32630206")]
        internal enum FABRIC_PROVISION_APPLICATION_TYPE_KIND
        {
            FABRIC_PROVISION_APPLICATION_TYPE_KIND_INVALID = 0x0000,
            FABRIC_PROVISION_APPLICATION_TYPE_KIND_IMAGE_STORE_PATH = 0x0001,
            FABRIC_PROVISION_APPLICATION_TYPE_KIND_EXTERNAL_STORE = 0x0002,
        }

        [Guid("eb589087-7afc-4f71-be3b-6f1a8e06555e")]
        internal enum FABRIC_APPLICATION_PACKAGE_CLEANUP_POLICY
        {
            FABRIC_APPLICATION_PACKAGE_CLEANUP_POLICY_INVALID = 0x0000,
            FABRIC_APPLICATION_PACKAGE_CLEANUP_POLICY_DEFAULT = 0x0001,
            FABRIC_APPLICATION_PACKAGE_CLEANUP_POLICY_AUTOMATIC = 0x0002,
            FABRIC_APPLICATION_PACKAGE_CLEANUP_POLICY_MANUAL = 0x0003,
        }
        
        [Guid("f22165b2-fdc7-4bfa-aea4-aa3af0e1be90")]
        internal enum FABRIC_PLACEMENT_POLICY_TYPE
        {
            FABRIC_PLACEMENT_POLICY_INVALID = 0x0000,
            FABRIC_PLACEMENT_POLICY_INVALID_DOMAIN = 0x0001,
            FABRIC_PLACEMENT_POLICY_REQUIRED_DOMAIN = 0x0002,
            FABRIC_PLACEMENT_POLICY_PREFERRED_PRIMARY_DOMAIN = 0x0003,
            FABRIC_PLACEMENT_POLICY_REQUIRED_DOMAIN_DISTRIBUTION = 0x0004,
            FABRIC_PLACEMENT_POLICY_NONPARTIALLY_PLACE_SERVICE = 0X0005
        }

        [Guid("b6159356-1c25-4467-b7ca-8ebd1a8e2cc9")]
        internal enum FABRIC_HEALTH_STATE_FILTER : int
        {
            FABRIC_HEALTH_STATE_FILTER_DEFAULT = 0x0000,
            FABRIC_HEALTH_STATE_FILTER_NONE = 0x0001,
            FABRIC_HEALTH_STATE_FILTER_OK = 0x0002,
            FABRIC_HEALTH_STATE_FILTER_WARNING = 0x0004,
            FABRIC_HEALTH_STATE_FILTER_ERROR = 0x0008,
            FABRIC_HEALTH_STATE_FILTER_ALL = 0xFFFF,
        }

        [Guid("9edf69ce-2e48-47d6-af01-4bb9122dba73")]
        internal enum FABRIC_NODE_DEACTIVATION_STATUS : int
        {
            FABRIC_NODE_DEACTIVATION_STATUS_NONE = 0x0000,
            FABRIC_NODE_DEACTIVATION_STATUS_SAFETY_CHECK_IN_PROGRESS = 0x0001,
            FABRIC_NODE_DEACTIVATION_STATUS_SAFETY_CHECK_COMPLETE = 0x0002,
            FABRIC_NODE_DEACTIVATION_STATUS_COMPLETED = 0x0003
        };

        [Guid("58e6b778-aac4-4863-b09e-cefff2e8ca5e")]
        internal enum FABRIC_NODE_DEACTIVATION_TASK_TYPE
        {
            FABRIC_NODE_DEACTIVATION_TASK_TYPE_INVALID = 0x0000,
            FABRIC_NODE_DEACTIVATION_TASK_TYPE_INFRASTRUCTURE = 0x0001,
            FABRIC_NODE_DEACTIVATION_TASK_TYPE_REPAIR = 0x0002,
            FABRIC_NODE_DEACTIVATION_TASK_TYPE_CLIENT = 0x0003
        };

        [Guid("c70f7576-594b-46db-b5d5-d11ee452d3ec")]
        internal enum FABRIC_SCALING_TRIGGER_KIND
        {
            FABRIC_SCALING_TRIGGER_KIND_INVALID = 0x0000,
            FABRIC_SCALING_TRIGGER_KIND_AVERAGE_PARTITION_LOAD = 0x0001,
            FABRIC_SCALING_TRIGGER_KIND_AVERAGE_SERVICE_LOAD = 0x0002
        };

        [Guid("a06cc6e2-ad3c-427e-9d7a-eb5bd929fe7f")]
        internal enum FABRIC_SCALING_MECHANISM_KIND
        {
            FABRIC_SCALING_MECHANISM_KIND_INVALID = 0x0000,
            FABRIC_SCALING_MECHANISM_KIND_SCALE_PARTITION_INSTANCE_COUNT = 0x0001,
            FABRIC_SCALING_MECHANISM_KIND_ADD_REMOVE_INCREMENTAL_NAMED_PARTITION = 0x0002
        };

        [Guid("88ebda38-7316-4024-ad0a-5e1ddea6bedd")]
        internal enum FABRIC_TEST_COMMAND_STATE_FILTER : int
        {
            FABRIC_TEST_COMMAND_STATE_FILTER_DEFAULT = 0x0000,
            FABRIC_TEST_COMMAND_STATE_FILTER_ALL = 0xFFFF,
            FABRIC_TEST_COMMAND_STATE_FILTER_RUNNING = 0x0001,
            FABRIC_TEST_COMMAND_STATE_FILTER_ROLLING_BACK = 0x0002,

            FABRIC_TEST_COMMAND_STATE_FILTER_COMPLETED_SUCCESSFULLY = 0x0008,
            FABRIC_TEST_COMMAND_STATE_FILTER_FAILED = 0x0010,
            FABRIC_TEST_COMMAND_STATE_FILTER_CANCELLED = 0x0020,
            FABRIC_TEST_COMMAND_STATE_FILTER_FORCE_CANCELLED = 0x0040
        }

        [Guid("7065b639-9d36-4f75-affb-f14ee9677544")]
        internal enum FABRIC_TEST_COMMAND_TYPE_FILTER : int
        {
            FABRIC_TEST_COMMAND_TYPE_FILTER_DEFAULT = 0x0000,
            FABRIC_TEST_COMMAND_TYPE_FILTER_ALL = 0xFFFF,
            FABRIC_TEST_COMMAND_TYPE_FILTER_PARTITION_DATA_LOSS = 0x0001,
            FABRIC_TEST_COMMAND_TYPE_FILTER_PARTITION_QUORUM_LOSS = 0x0002,
            FABRIC_TEST_COMMAND_TYPE_FILTER_PARTITION_RESTART = 0x0004,
            FABRIC_TEST_COMMAND_TYPE_FILTER_NODE_TRANSITION = 0x0008,
        }

        [Guid("95e0508e-77bf-405b-bdcb-5850a956ec35")]
        internal enum FABRIC_TEST_COMMAND_TYPE : int
        {
            FABRIC_TEST_COMMAND_TYPE_DEFAULT = 0x0000,
            FABRIC_TEST_COMMAND_TYPE_INVOKE_DATA_LOSS = 0x0001,
            FABRIC_TEST_COMMAND_TYPE_INVOKE_QUORUM_LOSS = 0x0002,
            FABRIC_TEST_COMMAND_TYPE_INVOKE_RESTART_PARTITION = 0x0004,
            FABRIC_TEST_COMMAND_TYPE_START_NODE_TRANSITION = 0x0008,
        }

        [Guid("5d6bf52f-763a-41cd-a1dd-2a25abe99278")]
        internal enum FABRIC_KEY_VALUE_STORE_MIGRATION_PHASE : int
        {
            FABRIC_KEY_VALUE_STORE_MIGRATION_PHASE_INACTIVE = 0,
            FABRIC_KEY_VALUE_STORE_MIGRATION_PHASE_MIGRATION = 1,
            FABRIC_KEY_VALUE_STORE_MIGRATION_PHASE_TARGET_DATABASE_SWAP = 2,
            FABRIC_KEY_VALUE_STORE_MIGRATION_PHASE_TARGET_DATABASE_CLEANUP = 3,
            FABRIC_KEY_VALUE_STORE_MIGRATION_PHASE_SOURCE_DATABASE_CLEANUP = 4,
            FABRIC_KEY_VALUE_STORE_MIGRATION_PHASE_TARGET_DATABASE_ACTIVE = 5,
            FABRIC_KEY_VALUE_STORE_MIGRATION_PHASE_RESTORE_SOURCE_BACKUP = 6,
        }

        [Guid("ea42b15a-57ed-4368-8910-6ffbfc832935")]
        internal enum FABRIC_KEY_VALUE_STORE_MIGRATION_STATE : int
        {
            FABRIC_KEY_VALUE_STORE_MIGRATION_STATE_INACTIVE = 0,
            FABRIC_KEY_VALUE_STORE_MIGRATION_STATE_PROCESSING = 1,
            FABRIC_KEY_VALUE_STORE_MIGRATION_STATE_COMPLETED = 2,
            FABRIC_KEY_VALUE_STORE_MIGRATION_STATE_CANCELED = 3,
            FABRIC_KEY_VALUE_STORE_MIGRATION_STATE_FAILED = 4,
        }

        [Guid("d78b5503-c676-4c11-92fb-af37f0c0e1b3")]
        internal enum FABRIC_KEY_VALUE_STORE_PROVIDER_KIND : int
        {
            FABRIC_KEY_VALUE_STORE_PROVIDER_KIND_UNKNOWN = 0,
            FABRIC_KEY_VALUE_STORE_PROVIDER_KIND_ESE = 1,
            FABRIC_KEY_VALUE_STORE_PROVIDER_KIND_TSTORE = 2,
        }

        [Guid("8D8DA86D-A812-4DAF-8D5C-7399B3685E8A")]
        internal enum FABRIC_NETWORK_TYPE : int
        {
            FABRIC_NETWORK_TYPE_INVALID = 0x0000,
            FABRIC_NETWORK_TYPE_LOCAL = 0x0001,
            FABRIC_NETWORK_TYPE_FEDERATED = 0x0002,
        }

        [Guid("EBBE4CB8-322D-4E44-8ACB-2CEFA19F08F6")]
        internal enum FABRIC_NETWORK_STATUS : int
        {
            FABRIC_NETWORK_STATUS_INVALID = 0x0000,
            FABRIC_NETWORK_STATUS_READY = 0x0001,
            FABRIC_NETWORK_STATUS_CREATING = 0x0002,
            FABRIC_NETWORK_STATUS_DELETING = 0x0003,
            FABRIC_NETWORK_STATUS_UPDATING = 0x0004,
            FABRIC_NETWORK_STATUS_FAILED = 0x0005,
        }

        [Guid("B492938D-9991-4613-84F5-3C10BF4E52A8")]
        internal enum FABRIC_NETWORK_STATUS_FILTER : int
        {
            FABRIC_NETWORK_STATUS_FILTER_DEFAULT = 0x0000,
            FABRIC_NETWORK_STATUS_FILTER_ALL = 0xFFFF,
            FABRIC_NETWORK_STATUS_FILTER_READY = 0x0001,
            FABRIC_NETWORK_STATUS_FILTER_CREATING = 0x0002,
            FABRIC_NETWORK_STATUS_FILTER_DELETING = 0x0004,
            FABRIC_NETWORK_STATUS_FILTER_UPDATING = 0x0008,
            FABRIC_NETWORK_STATUS_FILTER_FAILED = 0x0010
        }

        //// ----------------------------------------------------------------------------
        //// Structures

        [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1305:FieldNamesMustNotUseHungarianNotation", Justification = "Matches native API.")]
        [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter", Justification = "Reviewed.")]
        [StructLayout(LayoutKind.Sequential, Pack = 4)]
        internal struct NativeFILETIME
        {
            public UInt32 dwLowDateTime;
            public UInt32 dwHighDateTime;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_ID
        {
            public UInt64 Low;
            public UInt64 High;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_OPERATION_DATA_BUFFER
        {
            public UInt32 BufferSize;
            public IntPtr Buffer;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_OPERATION_DATA_BUFFER_EX1
        {
            public UInt32 Offset;
            public UInt32 Count;
            public IntPtr Buffer;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_MESSAGE_BUFFER
        {
            public UInt32 BufferSize;
            public IntPtr Buffer;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_LOAD_METRIC_DESCRIPTION
        {
            public IntPtr Name;
            public FABRIC_SERVICE_LOAD_METRIC_WEIGHT Weight;
            public UInt32 PrimaryDefaultLoad;
            public UInt32 SecondaryDefaultLoad;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_LOAD_METRIC_DESCRIPTION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_CORRELATION_DESCRIPTION
        {
            public IntPtr ServiceName;
            public FABRIC_SERVICE_CORRELATION_SCHEME Scheme;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_PARTITION_INFORMATION
        {
            public FABRIC_SERVICE_PARTITION_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SINGLETON_PARTITION_INFORMATION
        {
            public FABRIC_PARTITION_ID Id;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_INT64_RANGE_PARTITION_INFORMATION
        {
            public FABRIC_PARTITION_ID Id;
            public Int64 LowKey;
            public Int64 HighKey;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NAMED_PARTITION_INFORMATION
        {
            public FABRIC_PARTITION_ID Id;
            public IntPtr Name;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CODE_PACKAGE_ENTRY_POINT_DESCRIPTION
        {
            public FABRIC_CODE_PACKAGE_ENTRY_POINT_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINERHOST_ENTRY_POINT_DESCRIPTION
        {
            public IntPtr ImageName;
            public IntPtr Commands;
            public IntPtr EntryPoint;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_EXEHOST_ENTRY_POINT_DESCRIPTION
        {
            public IntPtr Program;
            public IntPtr Arguments;
            public FABRIC_EXEHOST_WORKING_FOLDER WorkingFolder;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_EXEHOST_ENTRY_POINT_DESCRIPTION_EX1
        {
            public UInt32 PeriodicIntervalInSeconds;
            public BOOLEAN ConsoleRedirectionEnabled;
            public UInt32 ConsoleRedirectionFileRetentionCount;
            public UInt32 ConsoleRedirectionFileMaxSizeInKb;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_EXEHOST_ENTRY_POINT_DESCRIPTION_EX2
        {
            public BOOLEAN IsExternalExecutable;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DLLHOST_HOSTED_DLL_DESCRIPTION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DLLHOST_HOSTED_DLL_DESCRIPTION
        {
            public FABRIC_DLLHOST_HOSTED_DLL_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DLLHOST_HOSTED_UNMANAGED_DLL_DESCRIPTION
        {
            public IntPtr DllName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DLLHOST_HOSTED_MANAGED_DLL_DESCRIPTION
        {
            public IntPtr AssemblyName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DLLHOST_ENTRY_POINT_DESCRIPTION
        {
            public FABRIC_DLLHOST_ISOLATION_POLICY IsolationPolicyType;
            public IntPtr HostedDlls;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CODE_PACKAGE_DESCRIPTION
        {
            public IntPtr Name;
            public IntPtr Version;
            public IntPtr ServiceManifestName;
            public IntPtr ServiceManifestVersion;
            public BOOLEAN IsShared;
            public IntPtr SetupEntryPoint;
            public IntPtr EntryPoint;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_RUNAS_POLICY_DESCRIPTION
        {
            public IntPtr UserName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONFIGURATION_PACKAGE_DESCRIPTION
        {
            public IntPtr Name;
            public IntPtr Version;
            public IntPtr ServiceManifestName;
            public IntPtr ServiceManifestVersion;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DATA_PACKAGE_DESCRIPTION
        {
            public IntPtr Name;
            public IntPtr Version;
            public IntPtr ServiceManifestName;
            public IntPtr ServiceManifestVersion;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_TYPE_DESCRIPTION
        {
            public FABRIC_SERVICE_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_TYPE_DESCRIPTION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_TYPE_DESCRIPTION_EXTENSION
        {
            public IntPtr Name;
            public IntPtr Value;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_TYPE_DESCRIPTION_EXTENSION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_TYPE_DESCRIPTION
        {
            public IntPtr ServiceTypeName;
            public IntPtr PlacementConstraints;
            public IntPtr LoadMetrics;
            public IntPtr Extensions;
            public BOOLEAN UseImplicitHost;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_TYPE_DESCRIPTION_EX1
        {
            public IntPtr PolicyList;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_TYPE_DESCRIPTION
        {
            public IntPtr ServiceTypeName;
            public IntPtr PlacementConstraints;
            public IntPtr LoadMetrics;
            public IntPtr Extensions;
            public BOOLEAN HasPersistedState;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_TYPE_DESCRIPTION_EX1
        {
            public IntPtr PolicyList;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_GROUP_TYPE_MEMBER_DESCRIPTION
        {
            public IntPtr ServiceTypeName;
            public IntPtr LoadMetrics;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_GROUP_TYPE_MEMBER_DESCRIPTION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_GROUP_TYPE_DESCRIPTION
        {
            public IntPtr Description;
            public IntPtr Members;
            public BOOLEAN UseImplicitFactory;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_GROUP_TYPE_DESCRIPTION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ENDPOINT_RESOURCE_DESCRIPTION
        {
            public IntPtr Name;
            public IntPtr Protocol;
            public IntPtr Type;
            public UInt32 Port;
            public IntPtr CertificateName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ENDPOINT_RESOURCE_DESCRIPTION_EX1
        {
            public IntPtr UriScheme;
            public IntPtr PathSuffix;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ENDPOINT_RESOURCE_DESCRIPTION_EX2
        {
            public IntPtr CodePackageName;
            public IntPtr IpAddressOrFqdn;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ENDPOINT_RESOURCE_DESCRIPTION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CODE_PACKAGE_DESCRIPTION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONFIGURATION_PACKAGE_DESCRIPTION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DATA_PACKAGE_DESCRIPTION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONFIGURATION_PARAMETER
        {
            public IntPtr Name;
            public IntPtr Value;
            public BOOLEAN MustOverride;
            public BOOLEAN IsEncrypted;
            public IntPtr Reserved;
        }
        internal struct FABRIC_CONFIGURATION_PARAMETER_EX1
        {
            public IntPtr Type;
            public IntPtr Reserved;
        }
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONFIGURATION_PARAMETER_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONFIGURATION_SECTION
        {
            public IntPtr Name;
            public IntPtr Parameters;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONFIGURATION_SECTION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONFIGURATION_SETTINGS
        {
            public IntPtr Sections;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STRING_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_EPOCH
        {
            public Int64 DataLossNumber;
            public Int64 ConfigurationNumber;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_OPERATION_METADATA
        {
            public FABRIC_OPERATION_TYPE Type;
            public FABRIC_SEQUENCE_NUMBER SequenceNumber;
            public FABRIC_ATOMIC_GROUP_ID AtomicGroupId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_OPERATION_METADATA_EX
        {
            public FABRIC_OPERATION_TYPE_EX Type;
            public FABRIC_SEQUENCE_NUMBER SequenceNumber;
            public FABRIC_SEQUENCE_NUMBER AtomicGroupId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICA_INFORMATION
        {
            public FABRIC_REPLICA_ID Id;
            public FABRIC_REPLICA_ROLE Role;
            public FABRIC_REPLICA_STATUS Status;
            public IntPtr ReplicatorAddress;
            public FABRIC_SEQUENCE_NUMBER CurrentProgress;
            public FABRIC_SEQUENCE_NUMBER CatchUpCapability;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICA_INFORMATION_EX1
        {
            public BOOLEAN MustCatchup;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICA_SET_CONFIGURATION
        {
            public UInt32 ReplicaCount;
            public IntPtr Replicas;
            public UInt32 WriteQuorum;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_LOAD_METRIC
        {
            public IntPtr Name;
            public UInt32 Value;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICATOR_SETTINGS
        {
            public UInt32 Flags;
            public UInt32 RetryIntervalMilliseconds;
            public UInt32 BatchAcknowledgementIntervalMilliseconds;
            public IntPtr ReplicatorAddress;
            public BOOLEAN RequireServiceAck;
            public UInt32 InitialReplicationQueueSize;
            public UInt32 MaxReplicationQueueSize;
            public UInt32 InitialCopyQueueSize;
            public UInt32 MaxCopyQueueSize;
            public IntPtr SecurityCredentials;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICATOR_SETTINGS_EX1
        {
            public UInt32 MaxReplicationQueueMemorySize;
            public BOOLEAN SecondaryClearAcknowledgedOperations;
            public UInt32 MaxReplicationMessageSize;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICATOR_SETTINGS_EX2
        {
            public BOOLEAN UseStreamFaultsAndEndOfStreamOperationAck;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICATOR_SETTINGS_EX3
        {
            public UInt32 InitialPrimaryReplicationQueueSize;
            public UInt32 MaxPrimaryReplicationQueueSize;
            public UInt32 MaxPrimaryReplicationQueueMemorySize;
            public UInt32 InitialSecondaryReplicationQueueSize;
            public UInt32 MaxSecondaryReplicationQueueSize;
            public UInt32 MaxSecondaryReplicationQueueMemorySize;
            public UInt32 PrimaryWaitForPendingQuorumsTimeoutMilliseconds;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICATOR_SETTINGS_EX4
        {
            public IntPtr ReplicatorListenAddress;
            public IntPtr ReplicatorPublishAddress;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICATOR_LOG_SETTINGS
        {
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NAMED_PROPERTY_METADATA
        {
            public IntPtr PropertyName;
            public FABRIC_PROPERTY_TYPE_ID TypeId;
            public Int32 ValueSize;
            public Int64 SequenceNumber;
            public System.Fabric.Interop.NativeTypes.NativeFILETIME LastModifiedUtc;
            public IntPtr Name;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NAMED_PROPERTY_METADATA_EX1
        {
            public IntPtr CustomTypeId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NAMED_PROPERTY
        {
            public IntPtr Metadata;
            public IntPtr Value;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PUT_PROPERTY_OPERATION
        {
            public IntPtr PropertyName;
            public FABRIC_PROPERTY_TYPE_ID PropertyTypeId;
            public IntPtr PropertyValue;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PUT_CUSTOM_PROPERTY_OPERATION
        {
            public IntPtr PropertyName;
            public FABRIC_PROPERTY_TYPE_ID PropertyTypeId;
            public IntPtr PropertyValue;
            public IntPtr PropertyCustomTypeId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_GET_PROPERTY_OPERATION
        {
            public IntPtr PropertyName;
            public BOOLEAN IncludeValue;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DELETE_PROPERTY_OPERATION
        {
            public IntPtr PropertyName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHECK_SEQUENCE_PROPERTY_OPERATION
        {
            public IntPtr PropertyName;
            public FABRIC_SEQUENCE_NUMBER SequenceNumber;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHECK_EXISTS_PROPERTY_OPERATION
        {
            public IntPtr PropertyName;
            public BOOLEAN ExistenceCheck;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHECK_VALUE_PROPERTY_OPERATION
        {
            public IntPtr PropertyName;
            public FABRIC_PROPERTY_TYPE_ID PropertyTypeId;
            public IntPtr PropertyValue;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PROPERTY_BATCH_OPERATION
        {
            public FABRIC_PROPERTY_BATCH_OPERATION_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_DESCRIPTION
        {
            public FABRIC_SERVICE_DESCRIPTION_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_TRANSITION_DESCRIPTION
        {
            public FABRIC_NODE_TRANSITION_TYPE NodeTransitionType;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_STOP_DESCRIPTION
        {
            public FABRIC_TESTABILITY_OPERATION_ID OperationId;
            public IntPtr NodeName;
            public FABRIC_NODE_INSTANCE_ID NodeInstanceId;
            public UInt32 StopDurationInSeconds;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_START_DESCRIPTION
        {
            public FABRIC_TESTABILITY_OPERATION_ID OperationId;
            public IntPtr NodeName;
            public FABRIC_NODE_INSTANCE_ID NodeInstanceId;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_UPDATE_DESCRIPTION
        {
            public FABRIC_SERVICE_DESCRIPTION_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UPGRADE_DOMAIN_STATUS_DESCRIPTION
        {
            public IntPtr Name;
            public FABRIC_UPGRADE_DOMAIN_STATE State;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UPGRADE_DOMAIN_STATUS_DESCRIPTION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SCALING_TRIGGER
        {
            public FABRIC_SCALING_TRIGGER_KIND ScalingTriggerKind;
            public IntPtr ScalingTriggerDescription;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SCALING_MECHANISM
        {
            public FABRIC_SCALING_MECHANISM_KIND ScalingMechanismKind;
            public IntPtr ScalingMechanismDescription;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SCALING_POLICY
        {
            public FABRIC_SCALING_TRIGGER ScalingPolicyTrigger;
            public FABRIC_SCALING_MECHANISM ScalingPolicyMechanism;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SCALING_TRIGGER_AVERAGE_PARTITION_LOAD
        {
            public IntPtr MetricName;
            public Double LowerLoadThreshold;
            public Double UpperLoadThreshold;
            public UInt32 ScaleIntervalInSeconds;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SCALING_TRIGGER_AVERAGE_SERVICE_LOAD
        {
            public IntPtr MetricName;
            public Double LowerLoadThreshold;
            public Double UpperLoadThreshold;
            public UInt32 ScaleIntervalInSeconds;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SCALING_TRIGGER_AVERAGE_SERVICE_LOAD_EX1
        {
            public BOOLEAN UseOnlyPrimaryLoad;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SCALING_MECHANISM_PARTITION_INSTANCE_COUNT
        {
            public Int32 MaximumInstanceCount;
            public Int32 MinimumInstanceCount;
            public Int32 ScaleIncrement;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SCALING_MECHANISM_ADD_REMOVE_INCREMENTAL_NAMED_PARTITION
        {
            public Int32 MaximumPartitionCount;
            public Int32 MinimumPartitionCount;
            public Int32 ScaleIncrement;
            public IntPtr Reserved;
        };

        // FABRIC_PLACEMENT_POLICY_TYPE = FABRIC_PLACEMENT_POLICY_INVALID_DOMAIN
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PLACEMENT_POLICY_INVALID_DOMAIN_DESCRIPTION
        {
            public IntPtr InvalidFaultDomain;
            public IntPtr Reserved;
        }

        // FABRIC_PLACEMENT_POLICY_TYPE = FABRIC_PLACEMENT_POLICY_REQUIRED_DOMAIN
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PLACEMENT_POLICY_REQUIRED_DOMAIN_DESCRIPTION
        {
            public IntPtr RequiredFaultDomain;
            public IntPtr Reserved;
        }

        // FABRIC_PLACEMENT_POLICY_TYPE = FABRIC_PLACEMENT_POLICY_PREFERRED_PRIMARY_DOMAIN
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PLACEMENT_POLICY_PREFERRED_PRIMARY_DOMAIN_DESCRIPTION
        {
            public IntPtr PreferredPrimaryFaultDomain;
            public IntPtr Reserved;
        }

        // FABRIC_PLACEMENT_POLICY_TYPE = FABRIC_PLACEMENT_REQUIRED_DOMAIN_DISTRIBUTION
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PLACEMENT_POLICY_REQUIRED_DOMAIN_DISTRIBUTION_DESCRIPTION
        {
            public IntPtr Reserved;
        }

        // FABRIC_PLACEMENT_POLICY_TYPE = FABRIC_PLACEMENT_POLICY_PARTIALLY_PLACE_SERVICE
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PLACEMENT_POLICY_NONPARTIALLY_PLACE_SERVICE_DESCRIPTION
        {
            public IntPtr Reserved;
        }

        // Used with DescriptionType = FABRIC_SERVICE_DESCRIPTION_KIND_STATELESS
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_DESCRIPTION
        {
            public IntPtr ApplicationName;
            public IntPtr ServiceName;
            public IntPtr ServiceTypeName;
            public UInt32 InitializationDataSize;
            public IntPtr InitializationData;
            public FABRIC_PARTITION_SCHEME PartitionScheme;
            public IntPtr PartitionSchemeDescription;
            public Int32 InstanceCount;
            public IntPtr PlacementConstraints;
            public UInt32 CorrelationCount;
            public IntPtr Correlations;
            public UInt32 MetricCount;
            public IntPtr Metrics;
            public IntPtr Reserved;
        }

        // Used with DescriptionType = FABRIC_SERVICE_DESCRIPTION_KIND_STATELESS
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_UPDATE_DESCRIPTION
        {
            public UInt32 Flags;
            public Int32 InstanceCount;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_UPDATE_DESCRIPTION_EX1
        {
            public IntPtr PlacementConstraints;
            public IntPtr PolicyList;
            public UInt32 CorrelationCount;
            public IntPtr Correlations;
            public UInt32 MetricCount;
            public IntPtr Metrics;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_UPDATE_DESCRIPTION_EX2
        {
            public FABRIC_MOVE_COST DefaultMoveCost;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_UPDATE_DESCRIPTION_EX3
        {
            public FABRIC_SERVICE_PARTITION_KIND RepartitionKind;
            public IntPtr RepartitionDescription;
            public UInt32 ScalingPolicyCount;
            public IntPtr ServiceScalingPolicies;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_PLACEMENT_POLICY_DESCRIPTION
        {
            public FABRIC_PLACEMENT_POLICY_TYPE Type;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_PLACEMENT_POLICY_LIST
        {
            public UInt32 PolicyCount;
            public IntPtr Policies;
        }

        // Used with DescriptionType = FABRIC_SERVICE_DESCRIPTION_KIND_STATELESS
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_DESCRIPTION_EX1
        {
            public IntPtr PolicyList;
            public IntPtr Reserved;
        }

        // Used with DescriptionType = FABRIC_SERVICE_DESCRIPTION_KIND_STATELESS
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_DESCRIPTION_EX2
        {
            public BOOLEAN IsDefaultMoveCostSpecified;
            public FABRIC_MOVE_COST DefaultMoveCost;
            public IntPtr Reserved;
        }

        // Used with DescriptionType = FABRIC_SERVICE_DESCRIPTION_KIND_STATELESS
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_DESCRIPTION_EX3
        {
            public FABRIC_SERVICE_PACKAGE_ACTIVATION_MODE ServicePackageActivationMode;
            public IntPtr ServiceDnsName;
            public IntPtr Reserved;
        }

        // Used with DescriptionType = FABRIC_SERVICE_DESCRIPTION_KIND_STATELESS
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_DESCRIPTION_EX4
        {
            public UInt32 ScalingPolicyCount;
            public IntPtr ServiceScalingPolicies;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NAMED_REPARTITION_DESCRIPTION
        {
            public UInt32 NamesToAddCount;
            public IntPtr NamesToAdd;
            public UInt32 NamesToRemoveCount;
            public IntPtr NamesToRemove;
        }

        // Used with DescriptionType = FABRIC_SERVICE_DESCRIPTION_KIND_STATEFUL
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_DESCRIPTION
        {
            public IntPtr ApplicationName;
            public IntPtr ServiceName;
            public IntPtr ServiceTypeName;
            public UInt32 InitializationDataSize;
            public IntPtr InitializationData;
            public FABRIC_PARTITION_SCHEME PartitionScheme;
            public IntPtr PartitionSchemeDescription;
            public Int32 TargetReplicaSetSize;
            public Int32 MinReplicaSetSize;
            public IntPtr PlacementConstraints;
            public UInt32 CorrelationCount;
            public IntPtr Correlations;
            public UInt32 MetricCount;
            public IntPtr Metrics;
            public BOOLEAN HasPersistedState;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_FAILOVER_SETTINGS
        {
            public UInt32 Flags;
            public UInt32 ReplicaRestartWaitDurationSeconds;
            public UInt32 QuorumLossWaitDurationSeconds;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_FAILOVER_SETTINGS_EX1
        {
            public UInt32 StandByReplicaKeepDurationSeconds;
            public IntPtr Reserved;
        }

        // Used with DescriptionType = FABRIC_SERVICE_DESCRIPTION_KIND_STATEFUL
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_DESCRIPTION_EX1
        {
            public IntPtr PolicyList;
            public IntPtr FailoverSettings;
            public IntPtr Reserved;
        }

        // Used with DescriptionType = FABRIC_SERVICE_DESCRIPTION_KIND_STATEFUL
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_DESCRIPTION_EX2
        {
            public BOOLEAN IsDefaultMoveCostSpecified;
            public FABRIC_MOVE_COST DefaultMoveCost;
            public IntPtr Reserved;
        }

        // Used with DescriptionType = FABRIC_SERVICE_DESCRIPTION_KIND_STATEFUL
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_DESCRIPTION_EX3
        {
            public FABRIC_SERVICE_PACKAGE_ACTIVATION_MODE ServicePackageActivationMode;
            public IntPtr ServiceDnsName;
            public IntPtr Reserved;
        }

        // Used with DescriptionType = FABRIC_SERVICE_DESCRIPTION_KIND_STATEFUL
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_DESCRIPTION_EX4
        {
            public UInt32 ScalingPolicyCount;
            public IntPtr ServiceScalingPolicies;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_UPDATE_DESCRIPTION
        {
            public UInt32 Flags;
            public Int32 TargetReplicaSetSize;
            public UInt32 ReplicaRestartWaitDurationSeconds;
            public UInt32 QuorumLossWaitDurationSeconds;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_UPDATE_DESCRIPTION_EX1
        {
            public UInt32 StandByReplicaKeepDurationSeconds;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_UPDATE_DESCRIPTION_EX2
        {
            public Int32 MinReplicaSetSize;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_UPDATE_DESCRIPTION_EX3
        {
            public IntPtr PlacementConstraints;
            public IntPtr PolicyList;
            public UInt32 CorrelationCount;
            public IntPtr Correlations;
            public UInt32 MetricCount;
            public IntPtr Metrics;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_UPDATE_DESCRIPTION_EX4
        {
            public FABRIC_MOVE_COST DefaultMoveCost;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_UPDATE_DESCRIPTION_EX5
        {
            public FABRIC_SERVICE_PARTITION_KIND RepartitionKind;
            public IntPtr RepartitionDescription;
            public UInt32 ScalingPolicyCount;
            public IntPtr ServiceScalingPolicies;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_DELETE_DESCRIPTION
        {
            public IntPtr ServiceName;
            public BOOLEAN ForceDelete;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_FROM_TEMPLATE_DESCRIPTION
        {
            public IntPtr ApplicationName;
            public IntPtr ServiceName;
            public IntPtr ServiceDnsName;
            public IntPtr ServiceTypeName;
            public FABRIC_SERVICE_PACKAGE_ACTIVATION_MODE ServicePackageActivationMode;
            public UInt32 InitializationDataSize;
            public IntPtr InitializationData;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_GROUP_FROM_TEMPLATE_DESCRIPTION
        {
            public IntPtr ApplicationName;
            public IntPtr ServiceName;
            public IntPtr ServiceTypeName;
            public FABRIC_SERVICE_PACKAGE_ACTIVATION_MODE ServicePackageActivationMode;
            public UInt32 InitializationDataSize;
            public IntPtr InitializationData;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UNIFORM_INT64_RANGE_PARTITION_DESCRIPTION
        {
            public Int32 PartitionCount;
            public Int64 LowKey;
            public Int64 HighKey;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NAMED_PARTITION_DESCRIPTION
        {
            public Int32 PartitionCount;
            public IntPtr Names;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_RESOLVED_SERVICE_ENDPOINT
        {
            public IntPtr Address;
            public FABRIC_SERVICE_ENDPOINT_ROLE Role;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_RESOLVED_SERVICE_PARTITION
        {
            public NativeTypes.FABRIC_SERVICE_PARTITION_INFORMATION Info;
            public UInt32 EndpointCount;
            public IntPtr Endpoints;
            public IntPtr ServiceName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_NOTIFICATION
        {
            public IntPtr ServiceName;
            public FABRIC_PARTITION_ID PartitionId;
            public UInt32 EndpointCount;
            public IntPtr Endpoints;
            public IntPtr PartitionInfo;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_NOTIFICATION_FILTER_DESCRIPTION
        {
            public IntPtr Name;
            public FABRIC_SERVICE_NOTIFICATION_FILTER_FLAGS Flags;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_PARAMETER
        {
            public IntPtr Name;
            public IntPtr Value;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_PARAMETER_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_DESCRIPTION
        {
            public IntPtr ApplicationName;
            public IntPtr ApplicationTypeName;
            public IntPtr ApplicationTypeVersion;
            public IntPtr ApplicationParameters;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_METRIC_DESCRIPTION
        {
            public IntPtr Name;
            public UInt32 NodeReservationCapacity;
            public UInt32 MaximumNodeCapacity;
            public UInt32 TotalApplicationCapacity;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_METRIC_LIST
        {
            public UInt32 Count;
            public IntPtr Metrics;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_UPDATE_DESCRIPTION
        {
            public UInt32 Flags;
            public IntPtr ApplicationName;
            public BOOLEAN RemoveApplicationCapacity;
            public UInt32 MaximumNodes;
            public UInt32 MinimumNodes;
            public IntPtr Metrics;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_CAPACITY_DESCRIPTION
        {
            public UInt32 MaximumNodes;
            public UInt32 MinimumNodes;
            public IntPtr Metrics;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_DESCRIPTION_EX1
        {
            public IntPtr ApplicationCapacity;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_UPGRADE_DESCRIPTION
        {
            public IntPtr ApplicationName;
            public IntPtr TargetApplicationTypeVersion;
            public IntPtr ApplicationParameters;
            public FABRIC_APPLICATION_UPGRADE_KIND UpgradeKind;
            public IntPtr UpgradePolicyDescription;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_UPGRADE_UPDATE_DESCRIPTION
        {
            public IntPtr ApplicationName;
            public FABRIC_APPLICATION_UPGRADE_KIND UpgradeKind;
            public UInt32 UpdateFlags;
            public IntPtr UpgradePolicyDescription;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_UPGRADE_PROGRESS
        {
            public IntPtr UpgradeDescription;
            public FABRIC_APPLICATION_UPGRADE_STATE UpgradeState;
            public FABRIC_ROLLING_UPGRADE_MODE UpgradeMode;
            public IntPtr NextUpgradeDomain;
            public IntPtr UpgradeDomains;
            public UInt32 UpgradeDurationInSeconds;
            public UInt32 CurrentUpgradeDomainDurationInSeconds;
            public IntPtr UnhealthyEvaluations;
            public IntPtr CurrentUpgradeDomainProgress;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_UPGRADE_PROGRESS_EX1
        {
            public NativeFILETIME StartTimestampUtc;
            public NativeFILETIME FailureTimestampUtc;
            public FABRIC_UPGRADE_FAILURE_REASON FailureReason;
            public IntPtr UpgradeDomainProgressAtFailure;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_UPGRADE_PROGRESS_EX2
        {
            public IntPtr UpgradeStatusDetails;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PROVISION_APPLICATION_TYPE_DESCRIPTION_BASE
        {
            public FABRIC_PROVISION_APPLICATION_TYPE_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PROVISION_APPLICATION_TYPE_DESCRIPTION
        {
            public IntPtr BuildPath;
            public BOOLEAN Async;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PROVISION_APPLICATION_TYPE_DESCRIPTION_EX1
        {
            public FABRIC_APPLICATION_PACKAGE_CLEANUP_POLICY ApplicationPackageCleanupPolicy;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_EXTERNAL_STORE_PROVISION_APPLICATION_TYPE_DESCRIPTION
        {
            public IntPtr ApplicationTypeName;
            public IntPtr ApplicationTypeVersion;
            public IntPtr ApplicationPackageDownloadUri;
            public BOOLEAN Async;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UNPROVISION_APPLICATION_TYPE_DESCRIPTION
        {
            public IntPtr ApplicationTypeName;
            public IntPtr ApplicationTypeVersion;
            public BOOLEAN Async;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_DELETE_DESCRIPTION
        {
            public IntPtr ApplicationName;
            public BOOLEAN ForceDelete;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DELETE_COMPOSE_DEPLOYMENT_DESCRIPTION
        {
            public IntPtr DeploymentName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UPGRADE_DESCRIPTION
        {
            public IntPtr CodeVersion;
            public IntPtr ConfigVersion;
            public FABRIC_UPGRADE_KIND UpgradeKind;
            public IntPtr UpgradePolicyDescription;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UPGRADE_UPDATE_DESCRIPTION
        {
            public FABRIC_UPGRADE_KIND UpgradeKind;
            public UInt32 UpdateFlags;
            public IntPtr UpgradePolicyDescription;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ORCHESTRATION_UPGRADE_PROGRESS
        {
            public FABRIC_UPGRADE_STATE UpgradeState;
            public UInt32 ProgressStatus;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ORCHESTRATION_UPGRADE_PROGRESS_EX1
        {
            public IntPtr ConfigVersion;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ORCHESTRATION_UPGRADE_PROGRESS_EX2
        {
            public IntPtr Details;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UPGRADE_ORCHESTRATION_SERVICE_STATE
        {
            public IntPtr CurrentCodeVersion;
            public IntPtr CurrentManifestVersion;
            public IntPtr TargetCodeVersion;
            public IntPtr TargetManifestVersion;
            public IntPtr PendingUpgradeType;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UPGRADE_PROGRESS
        {
            public IntPtr UpgradeDescription;
            public FABRIC_UPGRADE_STATE UpgradeState;
            public FABRIC_ROLLING_UPGRADE_MODE UpgradeMode;
            public IntPtr NextUpgradeDomain;
            public IntPtr UpgradeDomains;
            public UInt32 UpgradeDurationInSeconds;
            public UInt32 CurrentUpgradeDomainDurationInSeconds;
            public IntPtr UnhealthyEvaluations;
            public IntPtr CurrentUpgradeDomainProgress;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UPGRADE_PROGRESS_EX1
        {
            public NativeFILETIME StartTimestampUtc;
            public NativeFILETIME FailureTimestampUtc;
            public FABRIC_UPGRADE_FAILURE_REASON FailureReason;
            public IntPtr UpgradeDomainProgressAtFailure;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ROLLING_UPGRADE_POLICY_DESCRIPTION
        {
            public FABRIC_ROLLING_UPGRADE_MODE RollingUpgradeMode;
            public BOOLEAN ForceRestart;
            public UInt32 UpgradeReplicaSetCheckTimeoutInSeconds;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ROLLING_UPGRADE_MONITORING_POLICY
        {
            public FABRIC_MONITORED_UPGRADE_FAILURE_ACTION FailureAction;
            public UInt32 HealthCheckWaitDurationInSeconds;
            public UInt32 HealthCheckRetryTimeoutInSeconds;
            public UInt32 UpgradeTimeoutInSeconds;
            public UInt32 UpgradeDomainTimeoutInSeconds;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ROLLING_UPGRADE_MONITORING_POLICY_EX1
        {
            public UInt32 HealthCheckStableDurationInSeconds;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ROLLING_UPGRADE_POLICY_DESCRIPTION_EX1
        {
            public IntPtr MonitoringPolicy;
            public IntPtr HealthPolicy;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ROLLING_UPGRADE_POLICY_DESCRIPTION_EX2
        {
            public BOOLEAN EnableDeltaHealthEvaluation;
            public IntPtr UpgradeHealthPolicy;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_GROUP_MEMBER_DESCRIPTION
        {
            public IntPtr ServiceTypeName;
            public IntPtr ServiceName;
            public UInt32 InitializationDataSize;
            public IntPtr InitializationData;
            public UInt32 MetricCount;
            public IntPtr Metrics;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_GROUP_DESCRIPTION
        {
            public IntPtr Description;
            public UInt32 MemberCount;
            public IntPtr MemberDescriptions;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_GROUP_UPDATE_DESCRIPTION
        {
            public IntPtr UpdateDescription;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STRING_PAIR
        {
            public IntPtr Name;
            public IntPtr Value;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STRING_PAIR_LIST
        {
            public Int32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_CONTEXT
        {
            public IntPtr NodeName;
            public IntPtr NodeType;
            public IntPtr IPAddressOrFQDN;
            public FABRIC_NODE_INSTANCE_ID NodeInstanceId;
            public FABRIC_NODE_ID NodeId;
            public IntPtr Reserved;
        }

        //[StructLayout(LayoutKind.Sequential, Pack = 8)]
        //internal struct FABRIC_NODE_CONTEXT_EX1
        //{
        //    public IntPtr SharedLogFilePath;
        //    public IntPtr SharedLogFileId;
        //    public Int32 SharedLogFileSizeInMB;
        //    public IntPtr Reserved;
        //}

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLIENT_SETTINGS
        {
            public UInt32 PartitionLocationCacheLimit;
            public UInt32 ServiceChangePollIntervalInSeconds;
            public UInt32 ConnectionInitializationTimeoutInSeconds;
            public UInt32 KeepAliveIntervalInSeconds;
            public UInt32 HealthOperationTimeoutInSeconds;
            public UInt32 HealthReportSendIntervalInSeconds;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLIENT_SETTINGS_EX1
        {
            public IntPtr ClientFriendlyName;
            public UInt32 PartitionLocationCacheBucketCount;
            public UInt32 HealthReportRetrySendIntervalInSeconds;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLIENT_SETTINGS_EX2
        {
            public UInt32 NotificationGatewayConnectionTimeoutInSeconds;
            public UInt32 NotificationCacheUpdateTimeoutInSeconds;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLIENT_SETTINGS_EX3
        {
            public UInt32 AuthTokenBufferSize;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLIENT_SETTINGS_EX4
        {
            public UInt32 ConnectionIdleTimeoutInSeconds;
            public IntPtr Reserved;
        }


        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_GATEWAY_INFORMATION
        {
            public IntPtr NodeAddress;
            public FABRIC_NODE_ID NodeId;
            public FABRIC_NODE_INSTANCE_ID NodeInstanceId;
            public IntPtr NodeName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_TOKEN_CLAIM
        {
            public IntPtr ClaimType;
            public IntPtr Issuer;
            public IntPtr OriginalIssuer;
            public IntPtr Subject;
            public IntPtr Value;
            public IntPtr ValueType;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_TOKEN_CLAIM_RESULT_LIST
        {
            public Int32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_TOKEN_SERVICE_METADATA
        {
            public IntPtr Metadata;
            public IntPtr ServiceName;
            public IntPtr ServiceDnsName;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_RESTART_DEPLOYED_CODE_PACKAGE_DESCRIPTION
        {
            public IntPtr NodeName;
            public IntPtr ApplicationName;
            public IntPtr ServiceManifestName;
            public IntPtr CodePackageName;
            public FABRIC_INSTANCE_ID CodePackageInstanceId;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_COMPOSE_DEPLOYMENT_DESCRIPTION
        {
            public IntPtr DeploymentName;
            public IntPtr ComposeFilePath;
            public IntPtr OverridesFilePath;
            public IntPtr ContainerRepositoryUserName;
            public IntPtr ContainerRepositoryPassword;
            public BOOLEAN IsRepositoryPasswordEncrypted;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_DESCRIPTION
        {
            public IntPtr DeploymentName;
            public FABRIC_STRING_LIST ComposeFilePaths;
            public FABRIC_STRING_LIST ServiceFabricSettingsFilePaths;
            public IntPtr ContainerRegistryUserName;
            public IntPtr ContainerRegistryPassword;
            public BOOLEAN IsRegistryPasswordEncrypted;
            public FABRIC_APPLICATION_UPGRADE_KIND UpgradeKind;
            public IntPtr UpgradePolicyDescription;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_PROGRESS
        {
            public IntPtr DeploymentName;
            public IntPtr ApplicationName;
            public FABRIC_APPLICATION_UPGRADE_KIND UpgradeKind;
            public IntPtr UpgradePolicyDescription;
            public IntPtr TargetApplicationTypeVersion;
            public FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE UpgradeState;
            public IntPtr NextUpgradeDomain;
            public IntPtr UpgradeDomains;
            public UInt32 UpgradeDurationInSeconds;
            public UInt32 CurrentUpgradeDomainDurationInSeconds;
            public IntPtr ApplicationUnhealthyEvaluations;
            public IntPtr CurrentUpgradeDomainProgress;
            public NativeFILETIME StartTimestampUtc;
            public NativeFILETIME FailureTimestampUtc;
            public FABRIC_UPGRADE_FAILURE_REASON FailureReason;
            public IntPtr UpgradeDomainProgressAtFailure;
            public IntPtr UpgradeStatusDetails;
            public IntPtr ApplicationUpgradeStatusDetails;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_RESTART_NODE_DESCRIPTION
        {
            public IntPtr NodeName;
            public FABRIC_NODE_INSTANCE_ID NodeInstanceId;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_RESTART_NODE_DESCRIPTION_EX1
        {
            public BOOLEAN CreateFabricDump;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STOP_NODE_DESCRIPTION
        {
            public IntPtr NodeName;
            public FABRIC_NODE_INSTANCE_ID NodeInstanceId;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_START_NODE_DESCRIPTION
        {
            public IntPtr NodeName;
            public FABRIC_NODE_INSTANCE_ID NodeInstanceId;
            public IntPtr IPAddressOrFQDN;
            public UInt32 ClusterConnectionPort;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_RESTART_REPLICA_DESCRIPTION
        {
            public IntPtr NodeName;
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_REPLICA_ID ReplicaOrInstanceId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REMOVE_REPLICA_DESCRIPTION
        {
            public IntPtr NodeName;
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_REPLICA_ID ReplicaOrInstanceId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REMOVE_REPLICA_DESCRIPTION_EX1
        {
            public BOOLEAN ForceRemove;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PROMOTE_PRIMARY_REPLICA_DESCRIPTION
        {
            public IntPtr NodeName;
            public FABRIC_PARTITION_ID PartitionId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_MOVE_PRIMARY_REPLICA_DESCRIPTION
        {
            public IntPtr NodeName;
            public FABRIC_PARTITION_ID PartitionId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_MOVE_PRIMARY_REPLICA_DESCRIPTION_EX1
        {
            public BOOLEAN IgnoreConstraints;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_MOVE_SECONDARY_REPLICA_DESCRIPTION
        {
            public IntPtr CurrentSecondaryNodeName;
            public IntPtr NewSecondaryNodeName;
            public FABRIC_PARTITION_ID PartitionId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_MOVE_SECONDARY_REPLICA_DESCRIPTION_EX1
        {
            public BOOLEAN IgnoreConstraints;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_COMPOSE_DEPLOYMENT_ROLLBACK_DESCRIPTION
        {
            public IntPtr DeploymentName;
            public IntPtr Reserved;
        }

        #region  Secret Store Structures

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECRET
        {
            public IntPtr Name;
            public IntPtr Version;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECRET_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECRET_REFERENCE
        {
            public IntPtr Name;
            public IntPtr Version;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECRET_REFERENCE_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        #endregion

        #region Repair Manager Structures

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPAIR_SCOPE_IDENTIFIER
        {
            public FABRIC_REPAIR_SCOPE_IDENTIFIER_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPAIR_TARGET_DESCRIPTION
        {
            public FABRIC_REPAIR_TARGET_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPAIR_NODE_IMPACT
        {
            public IntPtr NodeName;
            public FABRIC_REPAIR_NODE_IMPACT_LEVEL ImpactLevel;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPAIR_NODE_IMPACT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPAIR_IMPACT_DESCRIPTION
        {
            public FABRIC_REPAIR_IMPACT_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPAIR_RESULT_DESCRIPTION
        {
            public FABRIC_REPAIR_TASK_RESULT ResultStatus;
            public int ResultCode;
            public IntPtr ResultDetails;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPAIR_TASK_HISTORY
        {
            public NativeFILETIME CreatedUtcTimestamp;
            public NativeFILETIME ClaimedUtcTimestamp;
            public NativeFILETIME PreparingUtcTimestamp;
            public NativeFILETIME ApprovedUtcTimestamp;
            public NativeFILETIME ExecutingUtcTimestamp;
            public NativeFILETIME RestoringUtcTimestamp;
            public NativeFILETIME CompletedUtcTimestamp;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPAIR_TASK_HISTORY_EX1
        {
            public NativeFILETIME PreparingHealthCheckStartUtcTimestamp;
            public NativeFILETIME PreparingHealthCheckEndUtcTimestamp;
            public NativeFILETIME RestoringHealthCheckStartUtcTimestamp;
            public NativeFILETIME RestoringHealthCheckEndUtcTimestamp;

            public IntPtr Reserved;
        }

        /// <summary>
        /// The description structure passed to IFabricRepairManagermentClient2.BeginUpdateRepairTaskHealthPolicy
        /// to update the health policy.
        /// </summary>
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPAIR_TASK_HEALTH_POLICY_UPDATE_DESCRIPTION
        {
            public IntPtr Scope;
            public IntPtr RepairTaskId;
            public Int64 Version;

            /// <summary>
            /// <see cref="System.Fabric.Interop.NativeTypes.FABRIC_REPAIR_TASK_HEALTH_POLICY_UPDATE_SETTINGS_FLAGS"/> to determine
            /// which members of this structure should be used for updating health policy.
            /// E.g. if we pass in PerformPreparingHealthCheck = false in
            /// <see cref="System.Fabric.Interop.NativeClient.IFabricRepairManagementClient2.BeginUpdateRepairTaskHealthPolicy"/>, does it mean
            /// unset the health check for the repair task or leave it unchanged from
            /// whatever state it was in during repair task creation?
            /// By checking this flag for the corresponding bit, we can determine
            /// whether to set/unset the boolean member.
            /// </summary>
            public UInt32 Flags;
            public BOOLEAN PerformPreparingHealthCheck;
            public BOOLEAN PerformRestoringHealthCheck;

            public IntPtr Reserved;

        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPAIR_EXECUTOR_STATE
        {
            public IntPtr Executor;
            public IntPtr ExecutorData;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPAIR_TASK
        {
            public IntPtr Scope;

            public IntPtr TaskId;
            public Int64 Version;
            public IntPtr Description;
            public FABRIC_REPAIR_TASK_STATE State;
            public UInt32 Flags;

            public IntPtr Action;
            public IntPtr Target;

            public IntPtr ExecutorState;
            public IntPtr Impact;
            public IntPtr Result;
            public IntPtr History;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPAIR_TASK_EX1
        {
            public BOOLEAN PerformPreparingHealthCheck;
            public BOOLEAN PerformRestoringHealthCheck;

            public FABRIC_REPAIR_TASK_HEALTH_CHECK_STATE PreparingHealthCheckState;
            public FABRIC_REPAIR_TASK_HEALTH_CHECK_STATE RestoringHealthCheckState;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPAIR_TASK_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPAIR_CANCEL_DESCRIPTION
        {
            public IntPtr Scope;
            public IntPtr RepairTaskId;
            public Int64 Version;
            public BOOLEAN RequestAbort;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPAIR_DELETE_DESCRIPTION
        {
            public IntPtr Scope;
            public IntPtr RepairTaskId;
            public Int64 Version;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPAIR_APPROVE_DESCRIPTION
        {
            public IntPtr Scope;
            public IntPtr RepairTaskId;
            public Int64 Version;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPAIR_TASK_QUERY_DESCRIPTION
        {
            public IntPtr Scope;
            public IntPtr TaskIdFilter;
            public UInt32 StateFilter;
            public IntPtr ExecutorFilter;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UNRELIABLETRANSPORT_BEHAVIOR
        {
            public IntPtr Destination;
            public IntPtr Action;
            public Double ProbabilityToApply;
            public Double DelayInSeconds;
            public Double DelaySpanInSeconds;
            public Int32 Priority;
            public Int32 ApplyCount;
            public IntPtr Filters;

            public IntPtr Reserved;
        }

        #endregion

        #region Key-Value Store Structures

        //// ----------------------------------------------------------------------------
        //// Key-Value Store Structures
        //// ----------------------------------------------------------------------------

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_KEY_VALUE_STORE_ITEM_METADATA
        {
            public IntPtr Key;
            public Int32 ValueSizeInBytes;
            public FABRIC_SEQUENCE_NUMBER SequenceNumber;
            public System.Fabric.Interop.NativeTypes.NativeFILETIME LastModifiedUtc;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_KEY_VALUE_STORE_ITEM_METADATA_EX1
        {
            public NativeTypes.NativeFILETIME LastModifiedOnPrimaryUtc;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_KEY_VALUE_STORE_ITEM
        {
            public IntPtr Metadata;
            public IntPtr Value;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_KEY_VALUE_STORE_TRANSACTION_SETTINGS
        {
            public UInt32 SerializationBlockSize;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_KEY_VALUE_STORE_RESTORE_SETTINGS
        {
            public BOOLEAN InlineReopen;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_KEY_VALUE_STORE_RESTORE_SETTINGS_EX1
        {
            public BOOLEAN EnableLsnCheck;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_KEY_VALUE_STORE_REPLICA_SETTINGS
        {
            public UInt32 TransactionDrainTimeoutInSeconds;
            public FABRIC_KEY_VALUE_STORE_NOTIFICATION_MODE SecondaryNotificationMode;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_KEY_VALUE_STORE_REPLICA_SETTINGS_EX1
        {
            public BOOLEAN EnableCopyNotificationPrefetch;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_KEY_VALUE_STORE_REPLICA_SETTINGS_EX2
        {
            public FABRIC_KEY_VALUE_STORE_FULL_COPY_MODE FullCopyMode;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_KEY_VALUE_STORE_REPLICA_SETTINGS_EX3
        {
            public Int32 LogTruncationIntervalInMinutes;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_KEY_VALUE_STORE_REPLICA_SETTINGS_V2
        {
            public IntPtr WorkingDirectory;
            public IntPtr SharedLogSettings;
            public FABRIC_KEY_VALUE_STORE_NOTIFICATION_MODE SecondaryNotificationMode;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct KTLLOGGER_SHARED_LOG_SETTINGS
        {
            public IntPtr ContainerPath;
            public IntPtr ContainerId;
            public Int64 LogSize;
            public Int32 MaximumNumberStreams;
            public Int32 MaximumRecordSize;
            public Int32 CreateFlags;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ESE_LOCAL_STORE_SETTINGS
        {
            public IntPtr DbFolderPath;
            public Int32 LogFileSizeInKB;
            public Int32 LogBufferSizeInKB;
            public Int32 MaxCursors;
            public Int32 MaxVerPages;
            public Int32 MaxAsyncCommitDelayInMilliseconds;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ESE_LOCAL_STORE_SETTINGS_EX1
        {
            public BOOLEAN EnableIncrementalBackup;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ESE_LOCAL_STORE_SETTINGS_EX2
        {
            public Int32 MaxCacheSizeInMB;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ESE_LOCAL_STORE_SETTINGS_EX3
        {
            public Int32 MaxDefragFrequencyInMinutes;
            public Int32 DefragThresholdInMB;
            public Int32 DatabasePageSizeInKB;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ESE_LOCAL_STORE_SETTINGS_EX4
        {
            public Int32 CompactionThresholdInMB;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ESE_LOCAL_STORE_SETTINGS_EX5
        {
            public Int32 IntrinsicValueThresholdInBytes;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ESE_LOCAL_STORE_SETTINGS_EX6
        {
            public BOOLEAN EnableOverwriteOnUpdate;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_TRANSPORT_SETTINGS
        {
            public UInt32 OperationTimeoutInSeconds;
            public UInt32 KeepAliveTimeoutInSeconds;
            public UInt32 MaxMessageSize;
            public UInt32 MaxConcurrentCalls;
            public UInt32 MaxQueueSize;
            public IntPtr SecurityCredentials;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_TRANSPORT_SETTINGS_EX1
        {
            public UInt32 ConnectTimeoutInMilliseconds;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_LISTENER_ADDRESS
        {
            public IntPtr IPAddressOrFQDN;
            public UInt32 Port;
            public IntPtr Path;
        }

        #endregion

        #region Health Structures

        //// ----------------------------------------------------------------------------
        //// Health Structures
        //// ----------------------------------------------------------------------------
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_HEALTH_REPORT
        {
            public FABRIC_HEALTH_REPORT_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_HEALTH_REPORT_SEND_OPTIONS
        {
            public BOOLEAN Immediate;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_HEALTH_INFORMATION
        {
            public IntPtr SourceId;
            public IntPtr Property;
            public UInt32 TimeToLiveSeconds;
            public FABRIC_HEALTH_STATE State;
            public IntPtr Description;
            public FABRIC_SEQUENCE_NUMBER SequenceNumber;
            public BOOLEAN RemoveWhenExpired;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLUSTER_HEALTH_REPORT
        {
            public IntPtr HealthInformation;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_INSTANCE_HEALTH_REPORT
        {
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_INSTANCE_ID InstanceId;
            public IntPtr HealthInformation;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_REPLICA_HEALTH_REPORT
        {
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_REPLICA_ID ReplicaId;
            public IntPtr HealthInformation;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_HEALTH_REPORT
        {
            public FABRIC_PARTITION_ID PartitionId;
            public IntPtr HealthInformation;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_HEALTH_REPORT
        {
            public IntPtr NodeName;
            public IntPtr HealthInformation;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH_REPORT
        {
            public IntPtr ApplicationName;
            public IntPtr HealthInformation;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_HEALTH_REPORT
        {
            public IntPtr ServiceName;
            public IntPtr HealthInformation;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_REPORT
        {
            public IntPtr ApplicationName;
            public IntPtr ServiceManifestName;
            public IntPtr NodeName;
            public IntPtr HealthInformation;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_REPORT_EX1
        {
            public IntPtr ServicePackageActivationId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_HEALTH_REPORT
        {
            public IntPtr ApplicationName;
            public IntPtr NodeName;
            public IntPtr HealthInformation;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_HEALTH_EVENT
        {
            public IntPtr HealthInformation;
            public System.Fabric.Interop.NativeTypes.NativeFILETIME SourceUtcTimestamp;
            public System.Fabric.Interop.NativeTypes.NativeFILETIME LastModifiedUtcTimestamp;
            public BOOLEAN IsExpired;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_HEALTH_EVENT_EX1
        {
            public System.Fabric.Interop.NativeTypes.NativeFILETIME LastOkTransitionAt;
            public System.Fabric.Interop.NativeTypes.NativeFILETIME LastWarningTransitionAt;
            public System.Fabric.Interop.NativeTypes.NativeFILETIME LastErrorTransitionAt;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_HEALTH_EVENT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_HEALTH_EVALUATION
        {
            public FABRIC_HEALTH_EVALUATION_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_HEALTH_EVALUATION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_TYPE_HEALTH_POLICY
        {
            public byte MaxPercentUnhealthyServices;
            public byte MaxPercentUnhealthyPartitionsPerService;
            public byte MaxPercentUnhealthyReplicasPerPartition;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_TYPE_HEALTH_POLICY_MAP_ITEM
        {
            public IntPtr ServiceTypeName;
            public IntPtr ServiceTypeHealthPolicy;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_TYPE_HEALTH_POLICY_MAP
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH_POLICY
        {
            public BOOLEAN ConsiderWarningAsError;
            public byte MaxPercentUnhealthyDeployedApplications;
            public IntPtr DefaultServiceTypeHealthPolicy;
            public IntPtr ServiceTypeHealthPolicyMap;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_SELECTOR
        {
            public IntPtr ServiceName;
            public FABRIC_PARTITION_SELECTOR_TYPE PartitionSelectorType;
            public IntPtr PartitionKey;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH_POLICY_MAP_ITEM
        {
            public IntPtr ApplicationName;
            public IntPtr HealthPolicy;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH_POLICY_MAP
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLUSTER_HEALTH_POLICY
        {
            public BOOLEAN ConsiderWarningAsError;
            public byte MaxPercentUnhealthyNodes;
            public byte MaxPercentUnhealthyApplications;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLUSTER_UPGRADE_HEALTH_POLICY
        {
            public byte MaxPercentDeltaUnhealthyNodes;
            public byte MaxPercentUpgradeDomainDeltaUnhealthyNodes;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_INSTANCE_HEALTH_STATE
        {
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_INSTANCE_ID InstanceId;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_REPLICA_HEALTH_STATE
        {
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_REPLICA_ID ReplicaId;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICA_HEALTH_STATE
        {
            public FABRIC_SERVICE_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICA_HEALTH_STATE_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_HEALTH_STATE
        {
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_HEALTH_STATE_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_HEALTH_STATE
        {
            public IntPtr ServiceName;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_HEALTH_STATE_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH
        {
            public IntPtr ApplicationName;
            public IntPtr ServiceManifestName;
            public IntPtr NodeName;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr HealthEvents;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_EX1
        {
            public IntPtr UnhealthyEvaluations;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_EX2
        {
            public IntPtr ServicePackageActivationId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_STATE
        {
            public IntPtr ApplicationName;
            public IntPtr ServiceManifestName;
            public IntPtr NodeName;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_STATE_EX1
        {
            public IntPtr ServicePackageActivationId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_STATE_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_HEALTH
        {
            public IntPtr ApplicationName;
            public IntPtr NodeName;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr HealthEvents;
            public IntPtr DeployedServicePackageHealthStates;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_HEALTH_EX1
        {
            public IntPtr UnhealthyEvaluations;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_HEALTH_EX2
        {
            public IntPtr HealthStatistics;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_HEALTH_STATE
        {
            public IntPtr ApplicationName;
            public IntPtr NodeName;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_HEALTH_STATE_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_REPLICA_HEALTH
        {
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_REPLICA_ID ReplicaId;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr HealthEvents;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_REPLICA_HEALTH_EX1
        {
            public IntPtr UnhealthyEvaluations;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_INSTANCE_HEALTH
        {
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_INSTANCE_ID InstanceId;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr HealthEvents;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_INSTANCE_HEALTH_EX1
        {
            public IntPtr UnhealthyEvaluations;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_HEALTH_STATE_COUNT
        {
            public UInt32 OkCount;
            public UInt32 WarningCount;
            public UInt32 ErrorCount;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ENTITY_KIND_HEALTH_STATE_COUNT
        {
            public FABRIC_HEALTH_ENTITY_KIND EntityKind;
            public IntPtr HealthStateCount;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_HEALTH_STATISTICS
        {
            public UInt32 Count;
            public IntPtr Items;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICA_HEALTH
        {
            public FABRIC_SERVICE_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_HEALTH
        {
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr HealthEvents;
            public IntPtr ReplicaHealthStates;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_HEALTH_EX1
        {
            public IntPtr UnhealthyEvaluations;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_HEALTH_EX2
        {
            public IntPtr HealthStatistics;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_HEALTH
        {
            public IntPtr ServiceName;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr HealthEvents;
            public IntPtr PartitionHealthStates;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_HEALTH_EX1
        {
            public IntPtr UnhealthyEvaluations;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_HEALTH_EX2
        {
            public IntPtr HealthStatistics;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH
        {
            public IntPtr ApplicationName;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr HealthEvents;
            public IntPtr DeployedApplicationHealthStates;
            public IntPtr ServiceHealthStates;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH_EX1
        {
            public IntPtr UnhealthyEvaluations;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH_EX2
        {
            public IntPtr HealthStatistics;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_HEALTH
        {
            public IntPtr NodeName;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr HealthEvents;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_HEALTH_EX1
        {
            public IntPtr UnhealthyEvaluations;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLUSTER_HEALTH
        {
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLUSTER_HEALTH_EX1
        {
            public IntPtr NodeHealthStates;
            public IntPtr ApplicationHealthStates;
            public IntPtr HealthEvents;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLUSTER_HEALTH_EX2
        {
            public IntPtr UnhealthyEvaluations;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLUSTER_HEALTH_EX3
        {
            public IntPtr HealthStatistics;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_HEALTH_STATE
        {
            public IntPtr NodeName;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_HEALTH_STATE_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH_STATE
        {
            public IntPtr ApplicationName;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH_STATE_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_EVENT_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr UnhealthyEvent;
            public BOOLEAN ConsiderWarningAsError;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICAS_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr UnhealthyEvaluations;
            public UInt32 TotalCount;
            public byte MaxPercentUnhealthyReplicasPerPartition;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITIONS_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr UnhealthyEvaluations;
            public UInt32 TotalCount;
            public byte MaxPercentUnhealthyPartitionsPerService;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGES_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr UnhealthyEvaluations;
            public UInt32 TotalCount;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATIONS_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr UnhealthyEvaluations;
            public UInt32 TotalCount;
            public byte MaxPercentUnhealthyDeployedApplications;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICES_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr ServiceTypeName;
            public IntPtr UnhealthyEvaluations;
            public UInt32 TotalCount;
            public byte MaxPercentUnhealthyServices;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODES_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr UnhealthyEvaluations;
            public UInt32 TotalCount;
            public byte MaxPercentUnhealthyNodes;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATIONS_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr UnhealthyEvaluations;
            public UInt32 TotalCount;
            public byte MaxPercentUnhealthyApplications;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UPGRADE_DOMAIN_NODES_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr UpgradeDomainName;
            public IntPtr UnhealthyEvaluations;
            public UInt32 TotalCount;
            public byte MaxPercentUnhealthyNodes;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UPGRADE_DOMAIN_DEPLOYED_APPLICATIONS_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr UpgradeDomainName;
            public IntPtr UnhealthyEvaluations;
            public UInt32 TotalCount;
            public byte MaxPercentUnhealthyDeployedApplications;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SYSTEM_APPLICATION_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr UnhealthyEvaluations;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public IntPtr NodeName;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr UnhealthyEvaluations;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICA_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_REPLICA_ID ReplicaOrInstanceId;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr UnhealthyEvaluations;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr UnhealthyEvaluations;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public IntPtr ServiceName;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr UnhealthyEvaluations;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public IntPtr ApplicationName;
            public IntPtr ServiceManifestName;
            public IntPtr NodeName;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr UnhealthyEvaluations;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_EVALUATION_EX1
        {
            public IntPtr ServicePackageActivationId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public IntPtr ApplicationName;
            public IntPtr NodeName;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr UnhealthyEvaluations;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public IntPtr ApplicationName;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr UnhealthyEvaluations;
            public IntPtr Reserved;
        }

        #endregion

        #region Query Structures

        //// ----------------------------------------------------------------------------
        //// Query Structures
        //// ----------------------------------------------------------------------------

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_QUERY_PAGING_DESCRIPTION
        {
            public IntPtr ContinuationToken;
            public Int64 MaxResults;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLUSTER_MANIFEST_QUERY_DESCRIPTION
        {
            public IntPtr ClusterManifestVersion;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_QUERY_DESCRIPTION
        {
            public IntPtr NodeNameFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_QUERY_RESULT_ITEM
        {
            public IntPtr NodeName;
            public IntPtr IpAddressOrFQDN;
            public IntPtr NodeType;
            public IntPtr CodeVersion;
            public IntPtr ConfigVersion;
            public FABRIC_QUERY_NODE_STATUS NodeStatus;
            public Int64 NodeUpTimeInSeconds;
            public FABRIC_HEALTH_STATE HealthState;
            public BOOLEAN IsSeedNode;
            public IntPtr UpgradeDomain;
            public IntPtr FaultDomain;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_QUERY_RESULT_ITEM_EX1
        {
            public FABRIC_NODE_ID NodeId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_QUERY_RESULT_ITEM_EX2
        {
            public FABRIC_NODE_INSTANCE_ID NodeInstanceId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_DEACTIVATION_TASK_ID
        {
            public IntPtr Id;
            public FABRIC_NODE_DEACTIVATION_TASK_TYPE Type;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_DEACTIVATION_TASK
        {
            public IntPtr TaskId;
            public FABRIC_NODE_DEACTIVATION_INTENT Intent;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_DEACTIVATION_TASK_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_DEACTIVATION_QUERY_RESULT_ITEM
        {
            public FABRIC_NODE_DEACTIVATION_INTENT EffectiveIntent;
            public FABRIC_NODE_DEACTIVATION_STATUS Status;
            public IntPtr Tasks;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SAFETY_CHECK
        {
            public FABRIC_SAFETY_CHECK_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_SAFETY_CHECK
        {
            public FABRIC_PARTITION_ID PartitionId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SEED_NODE_SAFETY_CHECK
        {
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SAFETY_CHECK_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_DEACTIVATION_QUERY_RESULT_ITEM_EX1
        {
            public IntPtr PendingSafetyChecks;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_QUERY_RESULT_ITEM_EX3
        {
            public IntPtr NodeDeactivationInfo;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_QUERY_RESULT_ITEM_EX4
        {
            public BOOLEAN IsStopped;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_QUERY_RESULT_ITEM_EX5
        {
            public Int64 NodeDownTimeInSeconds;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_QUERY_RESULT_ITEM_EX6
        {
            public System.Fabric.Interop.NativeTypes.NativeFILETIME NodeUpAt;
            public System.Fabric.Interop.NativeTypes.NativeFILETIME NodeDownAt;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_TYPE_QUERY_DESCRIPTION
        {
            public IntPtr ApplicationTypeNameFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_TYPE_PAGED_QUERY_DESCRIPTION
        {
            public IntPtr ApplicationTypeNameFilter;
            public Int64 MaxResults;
            public IntPtr ContinuationToken;
            public BOOLEAN ExcludeApplicationParameters;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_TYPE_PAGED_QUERY_DESCRIPTION_EX1
        {
            public IntPtr ApplicationTypeVersionFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_TYPE_PAGED_QUERY_DESCRIPTION_EX2
        {
            public UInt32 ApplicationTypeDefinitionKindFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_TYPE_QUERY_RESULT_ITEM
        {
            public IntPtr ApplicationTypeName;
            public IntPtr ApplicationTypeVersion;
            public IntPtr DefaultParameters;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_TYPE_QUERY_RESULT_ITEM_EX1
        {
            public FABRIC_APPLICATION_TYPE_STATUS Status;
            public IntPtr StatusDetails;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_TYPE_QUERY_RESULT_ITEM_EX2
        {
            public FABRIC_APPLICATION_TYPE_DEFINITION_KIND ApplicationTypeDefinitionKind;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_TYPE_QUERY_DESCRIPTION
        {
            public IntPtr ApplicationTypeName;
            public IntPtr ApplicationTypeVersion;
            public IntPtr ServiceTypeNameFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_GROUP_MEMBER_TYPE_QUERY_DESCRIPTION
        {
            public IntPtr ApplicationTypeName;
            public IntPtr ApplicationTypeVersion;
            public IntPtr ServiceGroupTypeNameFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_QUERY_DESCRIPTION
        {
            public IntPtr ApplicationNameFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_QUERY_DESCRIPTION_EX1
        {
            public IntPtr ContinuationToken;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_QUERY_DESCRIPTION_EX2
        {
            public IntPtr ApplicationTypeNameFilter;
            public BOOLEAN ExcludeApplicationParameters;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_QUERY_DESCRIPTION_EX3
        {
            public UInt32 ApplicationDefinitionKindFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_QUERY_DESCRIPTION_EX4
        {
            public Int64 MaxResults;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_QUERY_RESULT_ITEM
        {
            public IntPtr ApplicationName;
            public IntPtr ApplicationTypeName;
            public IntPtr ApplicationTypeVersion;
            public FABRIC_APPLICATION_STATUS Status;
            public FABRIC_HEALTH_STATE HealthState;
            public IntPtr ApplicationParameters;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_QUERY_RESULT_ITEM_EX1
        {
            public IntPtr UpgradeTypeVersion;
            public IntPtr UpgradeParameters;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_QUERY_RESULT_ITEM_EX2
        {
            public FABRIC_APPLICATION_DEFINITION_KIND ApplicationDefinitionKind;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_COMPOSE_DEPLOYMENT_STATUS_QUERY_DESCRIPTION
        {
            public IntPtr DeploymentNameFilter;
            public IntPtr ContinuationToken;
            public Int64 MaxResults;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_COMPOSE_DEPLOYMENT_STATUS_QUERY_RESULT_ITEM
        {
            public IntPtr DeploymentName;
            public IntPtr ApplicationName;
            public FABRIC_COMPOSE_DEPLOYMENT_STATUS Status;
            public IntPtr StatusDetails;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_TYPE_QUERY_RESULT_ITEM
        {
            public IntPtr ServiceTypeDescription;
            public IntPtr ServiceManifestVersion;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_TYPE_QUERY_RESULT_ITEM_EX1
        {
            public IntPtr ServiceManifestName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_TYPE_QUERY_RESULT_ITEM_EX2
        {
            public BOOLEAN IsServiceGroup;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_GROUP_MEMBER_TYPE_QUERY_RESULT_ITEM
        {
            public IntPtr ServiceGroupMemberTypeDescription;
            public IntPtr ServiceManifestVersion;
            public IntPtr ServiceManifestName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_QUERY_DESCRIPTION
        {
            public IntPtr ApplicationName;
            public IntPtr ServiceNameFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_QUERY_DESCRIPTION_EX1
        {
            public IntPtr ContinuationToken;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_QUERY_DESCRIPTION_EX2
        {
            public IntPtr ServiceTypeNameFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_QUERY_DESCRIPTION_EX3
        {
            public Int64 MaxResults;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SYSTEM_SERVICE_QUERY_DESCRIPTION
        {
            public IntPtr SystemServiceNameFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_QUERY_RESULT_ITEM
        {
            public FABRIC_SERVICE_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_QUERY_RESULT_ITEM
        {
            public IntPtr ServiceName;
            public IntPtr ServiceTypeName;
            public IntPtr ServiceManifestVersion;
            public FABRIC_HEALTH_STATE HealthState;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_QUERY_RESULT_ITEM_EX1
        {
            public FABRIC_QUERY_SERVICE_STATUS ServiceStatus;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_QUERY_RESULT_ITEM_EX2
        {
            public BOOLEAN IsServiceGroup;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_QUERY_RESULT_ITEM
        {
            public IntPtr ServiceName;
            public IntPtr ServiceTypeName;
            public IntPtr ServiceManifestVersion;
            public BOOLEAN HasPersistedState;
            public FABRIC_HEALTH_STATE HealthState;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_QUERY_RESULT_ITEM_EX1
        {
            public FABRIC_QUERY_SERVICE_STATUS ServiceStatus;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_QUERY_RESULT_ITEM_EX2
        {
            public BOOLEAN IsServiceGroup;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_GROUP_MEMBER_QUERY_DESCRIPTION
        {
            public IntPtr ApplicationName;
            public IntPtr ServiceNameFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_GROUP_MEMBER_MEMBER_QUERY_RESULT_ITEM
        {
            public IntPtr ServiceTypeName;
            public IntPtr ServiceName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_GROUP_MEMBER_QUERY_RESULT_ITEM
        {
            public IntPtr ServiceName;
            public IntPtr Members;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_LOAD_INFORMATION_QUERY_DESCRIPTION
        {
            public FABRIC_PARTITION_ID PartitionId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICA_LOAD_INFORMATION_QUERY_DESCRIPTION
        {
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_REPLICA_ID ReplicaOrInstanceId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UNPLACED_REPLICA_INFORMATION_QUERY_DESCRIPTION
        {
            public IntPtr ServiceName;
            public FABRIC_PARTITION_ID PartitionId;
            public BOOLEAN OnlyQueryPrimaries;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_PARTITION_QUERY_DESCRIPTION
        {
            public IntPtr ServiceName;
            public FABRIC_PARTITION_ID PartitionIdFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_PARTITION_QUERY_RESULT_ITEM
        {
            public FABRIC_SERVICE_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_PARTITION_QUERY_RESULT_ITEM
        {
            public IntPtr PartitionInformation;
            public Int32 InstanceCount;
            public FABRIC_HEALTH_STATE HealthState;
            public FABRIC_QUERY_SERVICE_PARTITION_STATUS PartitionStatus;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_PARTITION_QUERY_RESULT_ITEM
        {
            public IntPtr PartitionInformation;
            public Int32 TargetReplicaSetSize;
            public Int32 MinReplicaSetSize;
            public FABRIC_HEALTH_STATE HealthState;
            public FABRIC_QUERY_SERVICE_PARTITION_STATUS PartitionStatus;
            public Int64 LastQuorumLossDurationInSeconds;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_PARTITION_QUERY_RESULT_ITEM_EX1
        {
            public FABRIC_EPOCH PrimaryEpoch;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_REPLICA_QUERY_DESCRIPTION
        {
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_INSTANCE_ID ReplicaIdOrInstanceIdFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_REPLICA_QUERY_DESCRIPTION_EX1
        {
            public UInt32 ReplicaStatusFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_REPLICA_QUERY_RESULT_ITEM
        {
            public FABRIC_SERVICE_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATEFUL_SERVICE_REPLICA_QUERY_RESULT_ITEM
        {
            public FABRIC_REPLICA_ID ReplicaId;
            public FABRIC_REPLICA_ROLE ReplicaRole;
            public FABRIC_REPLICA_STATUS ReplicaStatus;
            public FABRIC_HEALTH_STATE HealthState;
            public IntPtr ReplicaAddress;
            public IntPtr NodeName;
            public Int64 LastInBuildDurationInSeconds;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STATELESS_SERVICE_INSTANCE_QUERY_RESULT_ITEM
        {
            public FABRIC_INSTANCE_ID InstanceId;
            public FABRIC_REPLICA_STATUS ReplicaStatus;
            public FABRIC_HEALTH_STATE HealthState;
            public IntPtr ReplicaAddress;
            public IntPtr NodeName;
            public Int64 LastInBuildDurationInSeconds;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_QUERY_DESCRIPTION
        {
            public IntPtr NodeName;
            public IntPtr ApplicationNameFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PAGED_DEPLOYED_APPLICATION_QUERY_DESCRIPTION
        {
            public IntPtr NodeName;
            public IntPtr ApplicationNameFilter;
            public BOOLEAN IncludeHealthState;
            public IntPtr PagingDescription;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_QUERY_RESULT_ITEM
        {
            public IntPtr ApplicationName;
            public IntPtr ApplicationTypeName;
            public FABRIC_DEPLOYMENT_STATUS DeployedApplicationStatus;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_QUERY_RESULT_ITEM_EX
        {
            public IntPtr WorkDirectory;
            public IntPtr LogDirectory;
            public IntPtr TempDirectory;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_QUERY_RESULT_ITEM_EX2
        {
            public IntPtr HealthState;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_QUERY_DESCRIPTION
        {
            public IntPtr NodeName;
            public IntPtr ApplicationName;
            public IntPtr ServiceManifestNameFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_QUERY_RESULT_ITEM
        {
            public IntPtr ServiceManifestName;
            public IntPtr ServiceManifestVersion;
            public FABRIC_DEPLOYMENT_STATUS DeployedServicePackageStatus;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_QUERY_RESULT_ITEM_EX1
        {
            public IntPtr ServicePackageActivationId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_TYPE_QUERY_DESCRIPTION
        {
            public IntPtr NodeName;
            public IntPtr ApplicationName;
            public IntPtr ServiceManifestNameFilter;
            public IntPtr ServiceTypeNameFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_TYPE_QUERY_RESULT_ITEM
        {
            public IntPtr ServiceTypeName;
            public IntPtr CodePackageName;
            public IntPtr ServiceManifestName;
            public FABRIC_SERVICE_TYPE_REGISTRATION_STATUS Status;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_TYPE_QUERY_RESULT_ITEM_EX1
        {
            public IntPtr ServicePackageActivationId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CODE_PACKAGE_ENTRY_POINT_STATISTICS
        {
            public UInt32 LastExitCode;
            public System.Fabric.Interop.NativeTypes.NativeFILETIME LastActivationUtc;
            public System.Fabric.Interop.NativeTypes.NativeFILETIME LastExitUtc;
            public System.Fabric.Interop.NativeTypes.NativeFILETIME LastSuccessfulActivationUtc;
            public System.Fabric.Interop.NativeTypes.NativeFILETIME LastSuccessfulExitUtc;
            public UInt32 ActivationCount;
            public UInt32 ActivationFailureCount;
            public UInt32 ContinuousActivationFailureCount;
            public UInt32 ExitCount;
            public UInt32 ExitFailureCount;
            public UInt32 ContinuousExitFailureCount;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CODE_PACKAGE_ENTRY_POINT
        {
            public IntPtr EntryPointLocation;
            public Int64 ProcessId;
            public IntPtr RunAsUserName;
            public FABRIC_ENTRY_POINT_STATUS EntryPointStatus;
            public System.Fabric.Interop.NativeTypes.NativeFILETIME NextActivationUtc;
            public IntPtr Statistics;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CODE_PACKAGE_ENTRY_POINT_EX1
        {
            public FABRIC_INSTANCE_ID CodePackageInstanceId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_CODE_PACKAGE_QUERY_DESCRIPTION
        {
            public IntPtr NodeName;
            public IntPtr ApplicationName;
            public IntPtr ServiceManifestNameFilter;
            public IntPtr CodePackageNameFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_CODE_PACKAGE_QUERY_RESULT_ITEM
        {
            public IntPtr CodePackageName;
            public IntPtr CodePackageVersion;
            public IntPtr ServiceManifestName;
            public UInt32 RunFrequencyInterval;
            public FABRIC_DEPLOYMENT_STATUS DeployedCodePackageStatus;
            public IntPtr SetupEntryPoint;
            public IntPtr EntryPoint;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_CODE_PACKAGE_QUERY_RESULT_ITEM_EX1
        {
            public IntPtr ServicePackageActivationId;
            public FABRIC_HOST_TYPE HostType;
            public FABRIC_HOST_ISOLATION_MODE HostIsolationMode;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_REPLICA_QUERY_DESCRIPTION
        {
            public IntPtr NodeName;
            public IntPtr ApplicationName;
            public IntPtr ServiceManifestNameFilter;
            public FABRIC_PARTITION_ID PartitionIdFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_REPLICA_QUERY_RESULT_ITEM
        {
            public FABRIC_SERVICE_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_STATEFUL_SERVICE_REPLICA_QUERY_RESULT_ITEM
        {
            public IntPtr ServiceName;
            public IntPtr ServiceTypeName;
            public IntPtr ServiceManifestVersion;
            public IntPtr CodePackageName;
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_REPLICA_ID ReplicaId;
            public FABRIC_REPLICA_ROLE ReplicaRole;
            public FABRIC_QUERY_SERVICE_REPLICA_STATUS ReplicaStatus;
            public IntPtr Address;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_STATEFUL_SERVICE_REPLICA_QUERY_RESULT_ITEM_EX1
        {
            public IntPtr ServiceManifestName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_STATEFUL_SERVICE_REPLICA_QUERY_RESULT_ITEM_EX2
        {
            public IntPtr ServicePackageActivationId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_STATEFUL_SERVICE_REPLICA_QUERY_RESULT_ITEM_EX3
        {
            public FABRIC_HOST_PROCESS_ID HostProcessId;
            public IntPtr ReconfigurationInformation;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_RECONFIGURATION_INFORMATION_QUERY_RESULT
        {
            public FABRIC_REPLICA_ROLE PreviousConfigurationRole;
            public FABRIC_RECONFIGURATION_PHASE ReconfigurationPhase;
            public FABRIC_RECONFIGURATION_TYPE ReconfigurationType;
            public NativeTypes.NativeFILETIME ReconfigurationStartTimeUtc;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_STATELESS_SERVICE_INSTANCE_QUERY_RESULT_ITEM
        {
            public IntPtr ServiceName;
            public IntPtr ServiceTypeName;
            public IntPtr ServiceManifestVersion;
            public IntPtr CodePackageName;
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_INSTANCE_ID InstanceId;
            public FABRIC_QUERY_SERVICE_REPLICA_STATUS ReplicaStatus;
            public IntPtr Address;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_STATELESS_SERVICE_INSTANCE_QUERY_RESULT_ITEM_EX1
        {
            public IntPtr ServiceManifestName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_STATELESS_SERVICE_INSTANCE_QUERY_RESULT_ITEM_EX2
        {
            public IntPtr ServicePackageActivationId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_STATELESS_SERVICE_INSTANCE_QUERY_RESULT_ITEM_EX3
        {
            public FABRIC_HOST_PROCESS_ID HostProcessId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_LOAD_METRIC_REPORT
        {
            public IntPtr Name;
            public UInt32 Value;
            public NativeTypes.NativeFILETIME LastReportedUtc;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REMOTE_REPLICATOR_STATUS_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_LOAD_METRIC_REPORT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_LOAD_METRIC_REPORT_EX1
        {
            public Double CurrentValue;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_TYPE_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_TYPE_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_GROUP_MEMBER_TYPE_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_COMPOSE_DEPLOYMENT_STATUS_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_TRANSPORT_BEHAVIOR_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_GROUP_MEMBER_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_GROUP_MEMBER_MEMBER_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_PARTITION_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_REPLICA_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_TYPE_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_CODE_PACKAGE_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_REPLICA_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_REPLICA_DETAIL_QUERY_DESCRIPTION
        {
            public IntPtr NodeName;
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_REPLICA_ID ReplicaId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REMOTE_REPLICATOR_STATUS
        {
            public FABRIC_REPLICA_ID ReplicaId;
            public NativeTypes.NativeFILETIME LastAcknowledgementProcessedTimeUtc;

            public FABRIC_SEQUENCE_NUMBER LastReceivedReplicationSequenceNumber;
            public FABRIC_SEQUENCE_NUMBER LastAppliedReplicationSequenceNumber;

            public BOOLEAN IsInBuild;
            public FABRIC_SEQUENCE_NUMBER LastReceivedCopySequenceNumber;
            public FABRIC_SEQUENCE_NUMBER LastAppliedCopySequenceNumber;

            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REMOTE_REPLICATOR_ACKNOWLEDGEMENT_DETAIL
        {
            public Int64 AverageReceiveDurationMilliseconds;
            public Int64 AverageApplyDurationMilliseconds;
            public FABRIC_SEQUENCE_NUMBER NotReceivedCount;
            public FABRIC_SEQUENCE_NUMBER ReceivedAndNotAppliedCount;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REMOTE_REPLICATOR_ACKNOWLEDGEMENT_STATUS
        {
            public IntPtr CopyStreamAcknowledgementDetails;
            public IntPtr ReplicationStreamAcknowledgementDetails;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICATOR_QUEUE_STATUS
        {
            public UInt32 QueueUtilizationPercentage;
            public Int64 QueueMemorySize;
            public FABRIC_SEQUENCE_NUMBER FirstSequenceNumber;
            public FABRIC_SEQUENCE_NUMBER CompletedSequenceNumber;
            public FABRIC_SEQUENCE_NUMBER CommittedSequenceNumber;
            public FABRIC_SEQUENCE_NUMBER LastSequenceNumber;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PRIMARY_REPLICATOR_STATUS_QUERY_RESULT
        {
            public IntPtr ReplicatonQueueStatus;
            public IntPtr RemoteReplicators;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICA_STATUS_QUERY_RESULT
        {
            public FABRIC_SERVICE_REPLICA_KIND Kind;
            public IntPtr Value;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECONDARY_REPLICATOR_STATUS_QUERY_RESULT
        {
            public IntPtr ReplicatonQueueStatus;
            public NativeTypes.NativeFILETIME LastReplicationOperationReceivedTimeUtc;

            public BOOLEAN IsInBuild;
            public IntPtr CopyQueueStatus;
            public NativeTypes.NativeFILETIME LastCopyOperationReceivedTimeUtc;

            public NativeTypes.NativeFILETIME LastAcknowledgementSentTimeUtc;

            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICATOR_STATUS_QUERY_RESULT
        {
            public FABRIC_REPLICA_ROLE Role;
            public IntPtr Value;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_REPLICA_DETAIL_QUERY_RESULT_ITEM
        {
            public FABRIC_SERVICE_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_STATEFUL_SERVICE_REPLICA_DETAIL_QUERY_RESULT_ITEM_EX1
        {
            public IntPtr ReplicaStatus;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_STATEFUL_SERVICE_REPLICA_DETAIL_QUERY_RESULT_ITEM_EX2
        {
            public IntPtr DeployedServiceReplica;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_KEY_VALUE_STORE_MIGRATION_QUERY_RESULT
        {
            public FABRIC_KEY_VALUE_STORE_MIGRATION_PHASE CurrentPhase;
            public FABRIC_KEY_VALUE_STORE_MIGRATION_STATE State;
            public FABRIC_KEY_VALUE_STORE_MIGRATION_PHASE NextPhase;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_KEY_VALUE_STORE_STATUS_QUERY_RESULT
        {
            public Int64 DatabaseRowCountEstimate;
            public Int64 DatabaseLogicalSizeEstimate;
            public IntPtr CopyNotificationCurrentKeyFilter;
            public Int64 CopyNotificationCurrentProgress;
            public IntPtr StatusDetails;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_KEY_VALUE_STORE_STATUS_QUERY_RESULT_EX1
        {
            public FABRIC_KEY_VALUE_STORE_PROVIDER_KIND ProviderKind;
            public IntPtr MigrationStatus;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_STATELESS_SERVICE_INSTANCE_DETAIL_QUERY_RESULT_ITEM
        {
            public IntPtr ServiceName;
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_INSTANCE_ID InstanceId;

            public FABRIC_QUERY_SERVICE_OPERATION_NAME CurrentServiceOperation;
            public NativeTypes.NativeFILETIME CurrentServiceOperationStartTimeUtc;

            public IntPtr ReportedLoad;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_STATELESS_SERVICE_INSTANCE_DETAIL_QUERY_RESULT_ITEM_EX1
        {
            public IntPtr DeployedServiceReplica;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_STATEFUL_SERVICE_REPLICA_DETAIL_QUERY_RESULT_ITEM
        {
            public IntPtr ServiceName;
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_REPLICA_ID ReplicaId;

            public FABRIC_QUERY_SERVICE_OPERATION_NAME CurrentServiceOperation;
            public NativeTypes.NativeFILETIME CurrentServiceOperationStartTimeUtc;
            public FABRIC_QUERY_REPLICATOR_OPERATION_NAME CurrentReplicatorOperation;

            public FABRIC_SERVICE_PARTITION_ACCESS_STATUS ReadStatus;
            public FABRIC_SERVICE_PARTITION_ACCESS_STATUS WriteStatus;

            public IntPtr ReportedLoad;

            public IntPtr ReplicatorStatus;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLUSTER_CODE_VERSION_LIST_QUERY_DESCRIPTION
        {
            public IntPtr CodeVersionFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_LOAD_INFORMATION_QUERY_DESCRIPTION
        {
            public IntPtr NodeName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_LOAD_METRIC_INFORMATION
        {
            public IntPtr Name;
            public Int64 NodeCapacity;
            public Int64 NodeLoad;
            public Int64 NodeRemainingCapacity;
            public BOOLEAN IsCapacityViolation;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_LOAD_METRIC_INFORMATION_EX1
        {
            public Int64 NodeBufferedCapacity;
            public Int64 NodeRemainingBufferedCapacity;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_LOAD_METRIC_INFORMATION_EX2
        {
            public Double CurrentNodeLoad;
            public Double NodeCapacityRemaining;
            public Double BufferedNodeCapacityRemaining;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_LOAD_METRIC_INFORMATION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_LOAD_INFORMATION
        {
            public IntPtr NodeName;
            public IntPtr NodeLoadMetricInformationList;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_LOAD_INFORMATION_QUERY_DESCRIPTION
        {
            public IntPtr ApplicationName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_LOAD_METRIC_INFORMATION
        {
            public IntPtr Name;
            public Int64 ReservationCapacity;
            public Int64 ApplicationCapacity;
            public Int64 ApplicationLoad;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_LOAD_METRIC_INFORMATION_LIST
        {
            public UInt32 Count;
            public IntPtr LoadMetrics;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_LOAD_INFORMATION
        {
            public IntPtr Name;
            public UInt32 MinimumNodes;
            public UInt32 MaximumNodes;
            public UInt32 NodeCount;
            public IntPtr ApplicationLoadMetricInformation;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_LOAD_METRIC_INFORMATION
        {
            public IntPtr Name;
            public BOOLEAN IsBalancedBefore;
            public BOOLEAN IsBalancedAfter;
            public Double DeviationBefore;
            public Double DeviationAfter;
            public Double BalancingThreshold;
            public IntPtr Action;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_LOAD_METRIC_INFORMATION_EX1
        {
            public UInt32 ActivityThreshold;
            public Int64 ClusterCapacity;
            public Int64 ClusterLoad;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_LOAD_METRIC_INFORMATION_EX2
        {
            public Int64 RemainingUnbufferedCapacity;
            public Double NodeBufferPercentage;
            public Int64 BufferedCapacity;
            public Int64 RemainingBufferedCapacity;
            public BOOLEAN IsClusterCapacityViolation;
            public Int64 MinNodeLoadValue;
            public FABRIC_NODE_ID MinNodeLoadNodeId;
            public Int64 MaxNodeLoadValue;
            public FABRIC_NODE_ID MaxNodeLoadNodeId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_LOAD_METRIC_INFORMATION_EX3
        {
            public Double CurrentClusterLoad;
            public Double BufferedClusterCapacityRemaining;
            public Double ClusterCapacityRemaining;
            public Double MaximumNodeLoad;
            public Double MinimumNodeLoad;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_LOAD_METRIC_INFORMATION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UNPLACED_REPLICA_INFORMATION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLUSTER_LOAD_INFORMATION
        {
            public NativeTypes.NativeFILETIME LastBalancingStartTimeUtc;
            public NativeTypes.NativeFILETIME LastBalancingEndTimeUtc;
            public IntPtr LoadMetricInformationList;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_LOAD_INFORMATION
        {
            public FABRIC_PARTITION_ID PartitionId;
            public IntPtr PrimaryLoadMetricReports;
            public IntPtr SecondaryLoadMetricReports;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICA_LOAD_INFORMATION
        {
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_REPLICA_ID ReplicaOrInstanceId;
            public IntPtr LoadMetricReports;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UNPLACED_REPLICA_INFORMATION
        {
            public IntPtr ServiceName;
            public FABRIC_PARTITION_ID PartitionId;
            public IntPtr UnplacedReplicaReasons;
            public IntPtr Reserved;
        }


        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PROVISIONED_CODE_VERSION_QUERY_DESCRIPTION
        {
            public IntPtr CodeVersionFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PROVISIONED_CODE_VERSION_QUERY_RESULT_ITEM
        {
            public IntPtr CodeVersion;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PROVISIONED_CODE_VERSION_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PROVISIONED_CONFIG_VERSION_QUERY_DESCRIPTION
        {
            public IntPtr ConfigVersionFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PROVISIONED_CONFIG_VERSION_QUERY_RESULT_ITEM
        {
            public IntPtr ConfigVersion;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PROVISIONED_CONFIG_VERSION_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UPGRADE_DOMAIN_PROGRESS
        {
            public IntPtr UpgradeDomainName;
            public IntPtr NodeProgressList;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_UPGRADE_PROGRESS_LIST
        {
            public Int32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_UPGRADE_PROGRESS
        {
            public IntPtr NodeName;
            public FABRIC_NODE_UPGRADE_PHASE UpgradePhase;
            public IntPtr PendingSafetyChecks;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UPGRADE_SAFETY_CHECK_LIST
        {
            public Int32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UPGRADE_SAFETY_CHECK
        {
            public FABRIC_UPGRADE_SAFETY_CHECK_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UPGRADE_PARTITION_SAFETY_CHECK
        {
            public FABRIC_PARTITION_ID PartitionId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UPGRADE_SEED_NODE_SAFETY_CHECK
        {
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_NAME_QUERY_DESCRIPTION
        {
            public FABRIC_PARTITION_ID PartitionId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_NAME_QUERY_RESULT
        {
            public IntPtr ServiceName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_NAME_QUERY_DESCRIPTION
        {
            public IntPtr ServiceName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_NAME_QUERY_RESULT
        {
            public IntPtr ApplicationName;
            public IntPtr Reserved;
        }

        #endregion

        #region Security Structures

        //// ----------------------------------------------------------------------------
        //// Security Structures
        //// ----------------------------------------------------------------------------

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECURITY_CREDENTIALS
        {
            public FABRIC_SECURITY_CREDENTIAL_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_X509_CREDENTIALS
        {
            public UInt32 RemoteCommonNameCount;
            public IntPtr RemoteCommonNames;
            public FABRIC_X509_FIND_TYPE FindType;
            public IntPtr FindValue;
            public FABRIC_X509_STORE_LOCATION StoreLocation;
            public IntPtr StoreName;
            public FABRIC_PROTECTION_LEVEL ProtectionLevel;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_X509_CREDENTIALS_EX1
        {
            public UInt32 IssuerThumbprintCount;
            public IntPtr IssuerThumbprints;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_X509_NAME
        {
            public IntPtr Name;
            public IntPtr IssuerCertThumbprint;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_X509_CREDENTIALS_EX2
        {
            public UInt32 RemoteCertThumbprintCount;
            public IntPtr RemoteCertThumbprints;
            public UInt32 RemoteX509NameCount;
            public IntPtr RemoteX509Names;
            public IntPtr FindValueSecondary;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_X509_ISSUER_NAME
        {
            public IntPtr Name;
            public UInt32 IssuerStoreCount;
            public IntPtr IssuerStores;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_X509_CREDENTIALS_EX3
        {
            public UInt32 RemoteCertIssuerCount;
            public IntPtr RemoteCertIssuers;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_WINDOWS_CREDENTIALS
        {
            public IntPtr RemoteSpn;
            public UInt32 RemoteIdentityCount;
            public IntPtr RemoteIdentities;
            public FABRIC_PROTECTION_LEVEL ProtectionLevel;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLAIMS_RETRIEVAL_METADATA
        {
            public FABRIC_CLAIMS_RETRIEVAL_METADATA_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_AAD_CLAIMS_RETRIEVAL_METADATA
        {
            public IntPtr Authority;
            public IntPtr TenantId;
            public IntPtr ClusterApplication;
            public IntPtr ClientApplication;
            public IntPtr ClientRedirect;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_AAD_CLAIMS_RETRIEVAL_METADATA_EX1
        {
            public IntPtr LoginEndpoint;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLAIMS_CREDENTIALS
        {
            public UInt32 ServerCommonNameCount;
            public IntPtr ServerCommonNames;
            public UInt32 IssuerThumbprintCount;
            public IntPtr IssuerThumbprints;
            public IntPtr LocalClaims;
            public FABRIC_PROTECTION_LEVEL ProtectionLevel;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLAIMS_CREDENTIALS_EX1
        {
            public UInt32 ServerThumbprintCount;
            public IntPtr ServerThumbprints;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECURITY_USER_DESCRIPTION
        {
            public IntPtr Name;
            public IntPtr Sid;
            public IntPtr ParentSystemGroups;
            public IntPtr ParentApplicationGroups;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECURITY_USER_DESCRIPTION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECURITY_GROUP_DESCRIPTION
        {
            public IntPtr Name;
            public IntPtr Sid;
            public IntPtr DomainGroupMembers;
            public IntPtr SystemGroupMembers;
            public IntPtr DomainUserMembers;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECURITY_GROUP_DESCRIPTION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_PRINCIPALS_DESCRIPTION
        {
            public IntPtr Users;
            public IntPtr Groups;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECURITY_RESOURCE_IDENTIFIER
        {
            public FABRIC_SECURITY_RESOURCE_IDENTIFIER_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECURITY_IMAGESTORE_PATH_RESOURCE_IDENTIFIER
        {
            public IntPtr Path;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECURITY_APPLICATION_TYPE_RESOURCE_IDENTIFIER
        {
            public IntPtr ApplicationTypeName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECURITY_NAME_RESOURCE_IDENTIFIER
        {
            public IntPtr Name;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECURITY_APPLICATION_RESOURCE_IDENTIFIER
        {
            public IntPtr ApplicationName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECURITY_SERVICE_RESOURCE_IDENTIFIER
        {
            public IntPtr ServiceName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECURITY_PRINCIPAL_IDENTIFIER
        {
            public FABRIC_SECURITY_PRINCIPAL_IDENTIFIER_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECURITY_X509_PRINCIPAL_IDENTIFIER
        {
            public IntPtr CommonName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECURITY_WINDOWS_PRINCIPAL_IDENTIFIER
        {
            public IntPtr AccountName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECURITY_CLAIM_PRINCIPAL_IDENTIFIER
        {
            public IntPtr Claim;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECURITY_ROLE_PRINCIPAL_IDENTIFIER
        {
            public IntPtr RoleName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECURITY_ACE
        {
            public FABRIC_SECURITY_ACE_TYPE AceType;
            public IntPtr Principal;
            public UInt32 AccessMask;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SECURITY_ACL
        {
            public UInt32 AceCount;
            public IntPtr AceItems;
            public IntPtr Reserved;
        }

        #endregion

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_QUERY_DESCRIPTION
        {
            public IntPtr ApplicationName;
            public IntPtr NodeName;
            public IntPtr ServiceManifestName;
            public IntPtr HealthPolicy;
            public IntPtr EventsFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_QUERY_DESCRIPTION_EX1
        {
            public IntPtr ServicePackageActivationId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_HEALTH_QUERY_DESCRIPTION
        {
            public IntPtr ApplicationName;
            public IntPtr NodeName;
            public IntPtr HealthPolicy;
            public IntPtr EventsFilter;
            public IntPtr DeployedServicePackagesFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_HEALTH_STATISTICS_FILTER
        {
            public BOOLEAN ExcludeHealthStatistics;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_HEALTH_QUERY_DESCRIPTION_EX1
        {
            public IntPtr HealthStatisticsFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICA_HEALTH_QUERY_DESCRIPTION
        {
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_REPLICA_ID ReplicaOrInstanceId;
            public IntPtr HealthPolicy;
            public IntPtr EventsFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_START_PARTITON_DATA_LOSS_DESCRIPTION
        {
            public FABRIC_TESTABILITY_OPERATION_ID OperationId;
            public IntPtr PartitionSelector;
            public FABRIC_DATA_LOSS_MODE DataLossMode;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_START_APPROVED_UPGRADES_DESCRIPTION
        {
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_START_UPGRADE_DESCRIPTION
        {
            public IntPtr ClusterConfig;
            public UInt32 HealthCheckWaitDurationInSeconds;
            public UInt32 HealthCheckRetryTimeoutInSeconds;
            public UInt32 HealthCheckStableDurationInSeconds;
            public UInt32 UpgradeTimeoutInSeconds;
            public UInt32 UpgradeDomainTimeoutInSeconds;
            public byte MaxPercentUnhealthyApplications;
            public byte MaxPercentUnhealthyNodes;
            public byte MaxPercentDeltaUnhealthyNodes;
            public byte MaxPercentUpgradeDomainDeltaUnhealthyNodes;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_START_UPGRADE_DESCRIPTION_EX1
        {
            public IntPtr ApplicationHealthPolicyMap;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CANCEL_TEST_COMMAND_DESCRIPTION
        {
            public FABRIC_TESTABILITY_OPERATION_ID OperationId;
            public BOOLEAN Force;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_DATA_LOSS_PROGRESS
        {
            public FABRIC_TEST_COMMAND_PROGRESS_STATE State;
            public IntPtr Result;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_DATA_LOSS_RESULT
        {
            public IntPtr SelectedPartition;
            public Int32 ErrorCode;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SELECTED_PARTITION
        {
            public IntPtr ServiceName;
            public FABRIC_PARTITION_ID PartitionId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SELECTED_REPLICA
        {
            public FABRIC_REPLICA_ID ReplicaOrInstanceId;
            public IntPtr PartitionSelected;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_RESULT
        {
            public IntPtr NodeName;
            public FABRIC_NODE_INSTANCE_ID NodeInstance;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_TEST_COMMAND_STATUS
        {
            public System.Guid OperationId;
            public FABRIC_TEST_COMMAND_PROGRESS_STATE TestCommandState;
            public FABRIC_TEST_COMMAND_TYPE TestCommandType;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_TEST_COMMAND_STATUS_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_RESTART_NODE_STATUS
        {
            public IntPtr NodeResult;
            public IntPtr SelectedReplica;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_START_PARTITION_QUORUM_LOSS_DESCRIPTION
        {
            public FABRIC_TESTABILITY_OPERATION_ID OperationId;
            public IntPtr PartitionSelector;
            public FABRIC_QUORUM_LOSS_MODE QuorumLossMode;
            public UInt32 QuorumLossDurationInMilliSeconds;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_QUORUM_LOSS_PROGRESS
        {
            public FABRIC_TEST_COMMAND_PROGRESS_STATE State;
            public IntPtr Result;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_QUORUM_LOSS_RESULT
        {
            public IntPtr SelectedPartition;
            public Int32 ErrorCode;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_RESTART_PROGRESS
        {
            public FABRIC_TEST_COMMAND_PROGRESS_STATE State;
            public IntPtr Result;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct PARTITION_RESTART_RESULT
        {
            public IntPtr SelectedPartition;
            public Int32 ErrorCode;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_START_PARTITION_RESTART_DESCRIPTION
        {
            public FABRIC_TESTABILITY_OPERATION_ID OperationId;
            public IntPtr PartitionSelector;
            public FABRIC_RESTART_PARTITION_MODE RestartPartitionMode;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_OPERATION_ID
        {
            public Guid PartitionId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_TEST_COMMAND_LIST_DESCRIPTION
        {
            public UInt32 TestCommandStateFilter;
            public UInt32 TestCommandTypeFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_TRANSITION_PROGRESS
        {
            public FABRIC_TEST_COMMAND_PROGRESS_STATE State;
            public IntPtr Result;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct NODE_TRANSITION_RESULT
        {
            public Int32 ErrorCode;
            public IntPtr NodeResult;
            public IntPtr Reserved;
        }

        #region Chaos
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_START_CHAOS_DESCRIPTION
        {
            public IntPtr ChaosParameters;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_PARAMETERS
        {
            public UInt32 MaxClusterStabilizationTimeoutInSeconds;
            public UInt32 MaxConcurrentFaults;
            public BOOLEAN EnableMoveReplicaFaults;
            public Int64 TimeToRunInSeconds;
            public UInt32 WaitTimeBetweenIterationsInSeconds;
            public UInt32 WaitTimeBetweenFaultsInSeconds;
            public IntPtr Context;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_PARAMETERS_EX1
        {
            public IntPtr ClusterHealthPolicy;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_PARAMETERS_EX2
        {
            public IntPtr ChaosTargetFilter;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_GET_CHAOS_REPORT_DESCRIPTION
        {
            public IntPtr Filter;
            public IntPtr ContinuationToken;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_EVENTS_SEGMENT_DESCRIPTION
        {
            public IntPtr Filter;
            public IntPtr PagingDescription;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_CLIENT_TYPE
        {
            public IntPtr ClientType;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_EVENT_CONTEXT_MAP_ITEM
        {
            public IntPtr Key;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_EVENT_CONTEXT_MAP
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STARTED_EVENT
        {
            public NativeFILETIME TimeStampUtc;
            public IntPtr ChaosParameters;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_EXECUTING_FAULTS_EVENT
        {
            public NativeFILETIME TimeStampUtc;
            public IntPtr Faults;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_WAITING_EVENT
        {
            public NativeFILETIME TimeStampUtc;
            public IntPtr Reason;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_VALIDATION_FAILED_EVENT
        {
            public NativeFILETIME TimeStampUtc;
            public IntPtr Reason;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_TEST_ERROR_EVENT
        {
            public NativeFILETIME TimeStampUtc;
            public IntPtr Reason;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STOPPED_EVENT
        {
            public NativeFILETIME TimeStampUtc;
            public IntPtr Reason;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_EVENT
        {
            public FABRIC_CHAOS_EVENT_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_EVENT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_REPORT_FILTER
        {
            public NativeFILETIME StartTimeUtc;
            public NativeFILETIME EndTimeUtc;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_REPORT
        {
            public IntPtr ChaosParameters;
            public FABRIC_CHAOS_STATUS Status;
            public IntPtr ContinuationToken;
            public IntPtr History;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_EVENTS_SEGMENT_FILTER
        {
            public NativeFILETIME StartTimeUtc;
            public NativeFILETIME EndTimeUtc;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_EVENTS_SEGMENT
        {
            public IntPtr ContinuationToken;
            public IntPtr History;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_CLUSTER_ENTITY_FILTER
        {
            public IntPtr NodeTypeInclusionList;
            public IntPtr ApplicationInclusionList;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_DESCRIPTION
        {
            public IntPtr ChaosParameters;
            public FABRIC_CHAOS_STATUS Status;
            public FABRIC_CHAOS_SCHEDULE_STATUS ScheduleStatus;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_SCHEDULE_TIME_UTC
        {
            public UInt32 Hour;
            public UInt32 Minute;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_SCHEDULE_TIME_RANGE_UTC
        {
            public IntPtr StartTime;
            public IntPtr EndTime;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_SCHEDULE_TIME_RANGE_UTC_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_SCHEDULE_JOB_ACTIVE_DAYS
        {
            public BOOLEAN Sunday;
            public BOOLEAN Monday;
            public BOOLEAN Tuesday;
            public BOOLEAN Wednesday;
            public BOOLEAN Thursday;
            public BOOLEAN Friday;
            public BOOLEAN Saturday;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_SCHEDULE_JOB
        {
            public IntPtr ChaosParameters;
            public IntPtr Days;
            public IntPtr Times;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_SCHEDULE_JOB_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_SCHEDULE_CHAOS_PARAMETERS_MAP_ITEM
        {
            public IntPtr Name;
            public IntPtr Parameters;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_SCHEDULE_CHAOS_PARAMETERS_MAP
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_SCHEDULE
        {
            public NativeFILETIME StartDate;
            public NativeFILETIME ExpiryDate;
            public IntPtr ChaosParametersMap;
            public IntPtr Jobs;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_SCHEDULE_DESCRIPTION
        {
            public UInt32 Version;
            public IntPtr Schedule;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CHAOS_SERVICE_SCHEDULE_DESCRIPTION
        {
            public IntPtr ChaosScheduleDescription;

            public IntPtr Reserved;
        }

        #endregion Chaos

        // IFaultManagementClient
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_RESTART_NODE_DESCRIPTION_USING_NODE_NAME
        {
            public IntPtr NodeName;
            public FABRIC_NODE_INSTANCE_ID NodeInstance;
            public BOOLEAN ShouldCreateFabricDump;
            public FABRIC_COMPLETION_MODE CompletionMode;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_RESTART_NODE_DESCRIPTION2
        {
            public FABRIC_RESTART_NODE_DESCRIPTION_KIND Kind;
            public IntPtr Value;
        }

        /// <summary>
        /// StartNode
        /// </summary>
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_START_NODE_DESCRIPTION_USING_NODE_NAME
        {
            public IntPtr NodeName;
            public FABRIC_NODE_INSTANCE_ID NodeInstance;
            public IntPtr IPAddressOrFQDN;
            public UInt32 ClusterConnectionPort;
            public FABRIC_COMPLETION_MODE CompletionMode;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_START_NODE_TRANSITION_DESCRIPTION
        {
            public FABRIC_TESTABILITY_OPERATION_ID OperationId;
            public FABRIC_NODE_TRANSITION_TYPE NodeTransitionType;
            public IntPtr NodeName;
            public FABRIC_NODE_INSTANCE_ID NodeInstanceId;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_START_NODE_DESCRIPTION2
        {
            public FABRIC_START_NODE_DESCRIPTION_KIND Kind;
            public IntPtr Value;
        }

        /// <summary>
        /// StopNode
        /// </summary>
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STOP_NODE_DESCRIPTION_USING_NODE_NAME
        {
            public IntPtr NodeName;
            public FABRIC_NODE_INSTANCE_ID NodeInstance;
            public FABRIC_COMPLETION_MODE CompletionMode;

            public IntPtr Reserved;
        }

        /// <summary>
        /// StopNode
        /// </summary>
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STOP_NODE_DESCRIPTION_INTERNAL
        {
            public IntPtr NodeName;
            public FABRIC_NODE_INSTANCE_ID NodeInstance;
            public Int32 StopDurationInSeconds;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STOP_NODE_DESCRIPTION2
        {
            public FABRIC_STOP_NODE_DESCRIPTION_KIND Kind;
            public IntPtr Value;
        }


        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STOP_NODE_DESCRIPTION3
        {
            public FABRIC_STOP_NODE_DESCRIPTION_KIND Kind;
            public IntPtr Value;
        }

        /// <summary>
        /// RestartDeployedCodePackage
        /// </summary>
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_RESTART_DEPLOYED_CODE_PACKAGE_DESCRIPTION_USING_NODE_NAME
        {
            public IntPtr NodeName;
            public IntPtr ApplicationName;
            public IntPtr ServiceManifestName;
            public IntPtr CodePackageName;
            public FABRIC_INSTANCE_ID CodePackageInstanceId;
            //public FABRIC_COMPLETION_MODE CompletionMode;

            public IntPtr Reserved;
        }

        internal struct FABRIC_RESTART_DEPLOYED_CODE_PACKAGE_DESCRIPTION_USING_NODE_NAME_EX1
        {
            public IntPtr ServicePackageActivationId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_RESTART_DEPLOYED_CODE_PACKAGE_DESCRIPTION2
        {
            public FABRIC_RESTART_DEPLOYED_CODE_PACKAGE_DESCRIPTION_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_CODE_PACKAGE_RESULT
        {
            public IntPtr NodeName;
            public IntPtr ApplicationName;
            public IntPtr ServiceManifestName;
            public IntPtr CodePackageName;
            public FABRIC_INSTANCE_ID CodePackageInstanceId;
            //public IntPtr SelectedReplica;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_CODE_PACKAGE_RESULT_EX1
        {
            public IntPtr ServicePackageActivationId;
            public IntPtr Reserved;
        }

        /// <summary>
        /// Move Primary
        /// </summary>
        ///
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_MOVE_PRIMARY_DESCRIPTION_USING_NODE_NAME
        {
            public IntPtr NodeName;
            public IntPtr ServiceName;
            public FABRIC_PARTITION_ID PartitionId;
            public BOOLEAN IgnoreConstraints;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_MOVE_PRIMARY_DESCRIPTION2
        {
            public FABRIC_MOVE_PRIMARY_DESCRIPTION_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_MOVE_PRIMARY_RESULT
        {
            public IntPtr NodeName;
            public IntPtr ServiceName;
            public FABRIC_PARTITION_ID PartitionId;

            public IntPtr Reserved;
        }

        /// <summary>
        /// Move Secondary
        /// </summary>
        ///
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_MOVE_SECONDARY_DESCRIPTION_USING_NODE_NAME
        {
            public IntPtr CurrentNodeName;
            public IntPtr NewNodeName;
            public IntPtr ServiceName;
            public FABRIC_PARTITION_ID PartitionId;
            public BOOLEAN IgnoreConstraints;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_MOVE_SECONDARY_DESCRIPTION2
        {
            public FABRIC_MOVE_SECONDARY_DESCRIPTION_KIND Kind;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_MOVE_SECONDARY_RESULT
        {
            public IntPtr CurrentNodeName;
            public IntPtr NewNodeName;
            public IntPtr ServiceName;
            public FABRIC_PARTITION_ID PartitionId;

            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_HEALTH_QUERY_DESCRIPTION
        {
            public FABRIC_PARTITION_ID PartitionId;
            public IntPtr HealthPolicy;
            public IntPtr EventsFilter;
            public IntPtr ReplicasFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_HEALTH_STATISTICS_FILTER
        {
            public BOOLEAN ExcludeHealthStatistics;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_HEALTH_QUERY_DESCRIPTION_EX1
        {
            public IntPtr HealthStatisticsFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_HEALTH_QUERY_DESCRIPTION
        {
            public IntPtr ServiceName;
            public IntPtr HealthPolicy;
            public IntPtr EventsFilter;
            public IntPtr PartitionsFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_HEALTH_STATISTICS_FILTER
        {
            public BOOLEAN ExcludeHealthStatistics;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_HEALTH_QUERY_DESCRIPTION_EX1
        {
            public IntPtr HealthStatisticsFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH_QUERY_DESCRIPTION
        {
            public IntPtr ApplicationName;
            public IntPtr HealthPolicy;
            public IntPtr EventsFilter;
            public IntPtr ServicesFilter;
            public IntPtr DeployedApplicationsFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH_STATISTICS_FILTER
        {
            public BOOLEAN ExcludeHealthStatistics;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH_QUERY_DESCRIPTION_EX1
        {
            public IntPtr HealthStatisticsFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_HEALTH_QUERY_DESCRIPTION
        {
            public IntPtr NodeName;
            public IntPtr HealthPolicy;
            public IntPtr EventsFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLUSTER_HEALTH_QUERY_DESCRIPTION
        {
            public IntPtr HealthPolicy;
            public IntPtr ApplicationHealthPolicyMap;
            public IntPtr EventsFilter;
            public IntPtr NodesFilter;
            public IntPtr ApplicationsFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLUSTER_HEALTH_STATISTICS_FILTER
        {
            public BOOLEAN ExcludeHealthStatistics;
            public BOOLEAN IncludeSystemApplicationHealthStatistics;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLUSTER_HEALTH_QUERY_DESCRIPTION_EX1
        {
            public IntPtr HealthStatisticsFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_STATES_FILTER
        {
            public UInt32 HealthStateFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_HEALTH_STATES_FILTER
        {
            public UInt32 HealthStateFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH_STATES_FILTER
        {
            public UInt32 HealthStateFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_HEALTH_STATES_FILTER
        {
            public UInt32 HealthStateFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_HEALTH_STATES_FILTER
        {
            public UInt32 HealthStateFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICA_HEALTH_STATES_FILTER
        {
            public UInt32 HealthStateFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_HEALTH_STATES_FILTER
        {
            public UInt32 HealthStateFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_HEALTH_EVENTS_FILTER
        {
            public UInt32 HealthStateFilter;
            public IntPtr Reserved;
        }

        #region Predeployment

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_MANIFEST_DESCRIPTION
        {
            public IntPtr Name;
            public IntPtr Version;
            public IntPtr ServiceTypes;
            public IntPtr ServiceGroupTypes;
            public IntPtr CodePackages;
            public IntPtr ConfigurationPackages;
            public IntPtr DataPackages;
            public IntPtr Endpoints;
            public IntPtr Reserved;
        }
        #endregion

        /// <summary>
        /// Provides info about the backup created on the store.
        /// </summary>
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STORE_BACKUP_INFO
        {
            /// <summary>
            /// The folder where the backup was created.
            /// </summary>
            public IntPtr BackupFolder;

            /// <summary>
            /// The backup option used.
            /// </summary>
            public FABRIC_STORE_BACKUP_OPTION BackupOption;

            /// <summary>
            /// Reserved for future use.
            /// </summary>
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_STORE_BACKUP_INFO_EX1
        {
            public Guid BackupChainId;
            public UInt32 BackupIndex;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DELTA_NODES_CHECK_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public UInt32 BaselineErrorCount;
            public UInt32 BaselineTotalCount;
            public UInt32 TotalCount;
            public byte MaxPercentDeltaUnhealthyNodes;
            public IntPtr UnhealthyEvaluations;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_UPGRADE_DOMAIN_DELTA_NODES_CHECK_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr UpgradeDomainName;
            public UInt32 BaselineErrorCount;
            public UInt32 BaselineTotalCount;
            public UInt32 TotalCount;
            public byte MaxPercentUpgradeDomainDeltaUnhealthyNodes;
            public IntPtr UnhealthyEvaluations;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PAGING_STATUS
        {
            public IntPtr ContinuationToken;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_QUERY_DESCRIPTION_EX1
        {
            public IntPtr ContinuationToken;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_QUERY_DESCRIPTION_EX2
        {
            public UInt32 NodeStatusFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_QUERY_DESCRIPTION_EX3
        {
            public Int64 MaxResults;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_PARTITION_QUERY_DESCRIPTION_EX1
        {
            public IntPtr ContinuationToken;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_REPLICA_QUERY_DESCRIPTION_EX2
        {
            public IntPtr ContinuationToken;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_TYPE_HEALTH_POLICY_MAP_ITEM
        {
            public IntPtr ApplicationTypeName;
            public byte MaxPercentUnhealthyApplications;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_TYPE_HEALTH_POLICY_MAP
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLUSTER_HEALTH_POLICY_EX1
        {
            public IntPtr ApplicationTypeHealthPolicyMap;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_TYPE_APPLICATIONS_HEALTH_EVALUATION
        {
            public IntPtr Description;
            public FABRIC_HEALTH_STATE AggregatedHealthState;
            public IntPtr ApplicationTypeName;
            public IntPtr UnhealthyEvaluations;
            public UInt32 TotalCount;
            public byte MaxPercentUnhealthyApplications;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_HEALTH_STATE_FILTER
        {
            public UInt32 HealthStateFilter;
            public IntPtr NodeNameFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_HEALTH_STATE_FILTER_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_STATE_FILTER
        {
            public UInt32 HealthStateFilter;
            public IntPtr ServiceManifestNameFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_STATE_FILTER_EX1
        {
            public IntPtr ServicePackageActivationIdFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_STATE_FILTER_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_HEALTH_STATE_FILTER
        {
            public UInt32 HealthStateFilter;
            public IntPtr NodeNameFilter;
            public IntPtr DeployedServicePackageFilters;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_HEALTH_STATE_FILTER_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICA_HEALTH_STATE_FILTER
        {
            public UInt32 HealthStateFilter;
            public FABRIC_REPLICA_ID ReplicaOrInstanceIdFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICA_HEALTH_STATE_FILTER_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_HEALTH_STATE_FILTER
        {
            public UInt32 HealthStateFilter;
            public FABRIC_PARTITION_ID PartitionIdFilter;
            public IntPtr ReplicaFilters;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_HEALTH_STATE_FILTER_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_HEALTH_STATE_FILTER
        {
            public UInt32 HealthStateFilter;
            public IntPtr ServiceNameFilter;
            public IntPtr PartitionFilters;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_HEALTH_STATE_FILTER_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH_STATE_FILTER
        {
            public UInt32 HealthStateFilter;
            public IntPtr ApplicationNameFilter;
            public IntPtr ServiceFilters;
            public IntPtr DeployedApplicationFilters;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH_STATE_FILTER_EX1
        {
            public IntPtr ApplicationTypeNameFilter;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH_STATE_FILTER_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLUSTER_HEALTH_CHUNK_QUERY_DESCRIPTION
        {
            public IntPtr ClusterHealthPolicy;
            public IntPtr ApplicationHealthPolicyMap;
            public IntPtr ApplicationFilters;
            public IntPtr NodeFilters;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_HEALTH_STATE_CHUNK
        {
            public IntPtr NodeName;
            public FABRIC_HEALTH_STATE HealthState;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NODE_HEALTH_STATE_CHUNK_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
            public UInt32 TotalCount;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICA_HEALTH_STATE_CHUNK
        {
            public FABRIC_REPLICA_ID ReplicaOrInstanceId;
            public FABRIC_HEALTH_STATE HealthState;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPLICA_HEALTH_STATE_CHUNK_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
            public UInt32 TotalCount;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_HEALTH_STATE_CHUNK
        {
            public FABRIC_PARTITION_ID PartitionId;
            public FABRIC_HEALTH_STATE HealthState;
            public IntPtr ReplicaHealthStateChunks;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PARTITION_HEALTH_STATE_CHUNK_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
            public UInt32 TotalCount;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_HEALTH_STATE_CHUNK
        {
            public IntPtr ServiceName;
            public FABRIC_HEALTH_STATE HealthState;
            public IntPtr PartitionHealthStateChunks;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_HEALTH_STATE_CHUNK_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
            public UInt32 TotalCount;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_STATE_CHUNK
        {
            public IntPtr ServiceManifestName;
            public FABRIC_HEALTH_STATE HealthState;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_STATE_CHUNK_EX1
        {
            public IntPtr ServicePackageActivationId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_STATE_CHUNK_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
            public UInt32 TotalCount;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_HEALTH_STATE_CHUNK
        {
            public IntPtr NodeName;
            public FABRIC_HEALTH_STATE HealthState;
            public IntPtr DeployedServicePackageHealthStateChunks;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_APPLICATION_HEALTH_STATE_CHUNK_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
            public UInt32 TotalCount;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH_STATE_CHUNK
        {
            public IntPtr ApplicationName;
            public FABRIC_HEALTH_STATE HealthState;
            public IntPtr ServiceHealthStateChunks;
            public IntPtr DeployedApplicationHealthStateChunks;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH_STATE_CHUNK_EX1
        {
            public IntPtr ApplicationTypeName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_HEALTH_STATE_CHUNK_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
            public UInt32 TotalCount;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CLUSTER_HEALTH_CHUNK
        {
            public FABRIC_HEALTH_STATE HealthState;
            public IntPtr NodeHealthStateChunks;
            public IntPtr ApplicationHealthStateChunks;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ROLLING_UPGRADE_POLICY_DESCRIPTION_EX3
        {
            public IntPtr ApplicationHealthPolicyMap;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NETWORK_DESCRIPTION
        {
            public FABRIC_NETWORK_TYPE NetworkType;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_LOCAL_NETWORK_DESCRIPTION
        {
            public IntPtr NetworkConfiguration;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_LOCAL_NETWORK_CONFIGURATION_DESCRIPTION
        {
            public IntPtr NetworkAddressPrefix;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DELETE_NETWORK_DESCRIPTION
        {
            public IntPtr NetworkName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NETWORK_INFORMATION
        {
            public FABRIC_NETWORK_TYPE NetworkType;
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_LOCAL_NETWORK_INFORMATION
        {
            public IntPtr NetworkName;
            public IntPtr NetworkConfiguration;
            public FABRIC_NETWORK_STATUS NetworkStatus;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NETWORK_QUERY_DESCRIPTION
        {
            public IntPtr NetworkNameFilter;
            public UInt32 NetworkStatusFilter;
            public IntPtr PagingDescription;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NETWORK_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NETWORK_APPLICATION_QUERY_DESCRIPTION
        {
            public IntPtr NetworkName;
            public IntPtr ApplicationNameFilter;
            public IntPtr PagingDescription;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NETWORK_APPLICATION_QUERY_RESULT_ITEM
        {
            public IntPtr ApplicationName;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NETWORK_APPLICATION_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NETWORK_NODE_QUERY_DESCRIPTION
        {
            public IntPtr NetworkName;
            public IntPtr NodeNameFilter;
            public IntPtr PagingDescription;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NETWORK_NODE_QUERY_RESULT_ITEM
        {
            public IntPtr NodeName;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_NETWORK_NODE_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_NETWORK_QUERY_DESCRIPTION
        {
            public IntPtr ApplicationName;
            public IntPtr PagingDescription;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_NETWORK_QUERY_RESULT_ITEM
        {
            public IntPtr NetworkName;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_APPLICATION_NETWORK_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_NETWORK_QUERY_DESCRIPTION
        {
            public IntPtr NodeName;
            public IntPtr PagingDescription;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_NETWORK_QUERY_RESULT_ITEM
        {
            public IntPtr NetworkName;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_NETWORK_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_NETWORK_CODE_PACKAGE_QUERY_DESCRIPTION
        {
            public IntPtr NodeName;
            public IntPtr NetworkName;
            public IntPtr ApplicationNameFilter;
            public IntPtr ServiceManifestNameFilter;
            public IntPtr CodePackageNameFilter;
            public IntPtr PagingDescription;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_NETWORK_CODE_PACKAGE_QUERY_RESULT_ITEM
        {
            public IntPtr ApplicationName;
            public IntPtr NetworkName;
            public IntPtr CodePackageName;
            public IntPtr CodePackageVersion;
            public IntPtr ServiceManifestName;
            public IntPtr ServicePackageActivationId;
            public IntPtr ContainerAddress;
            public IntPtr ContainerId;
            public IntPtr Reserved;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_DEPLOYED_NETWORK_CODE_PACKAGE_QUERY_RESULT_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }
        //// ----------------------------------------------------------------------------
        //// Internal structure required for CITs

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PACKAGE_SHARING_POLICY
        {
            public IntPtr PackageName;
            public FABRIC_PACKAGE_SHARING_POLICY_SCOPE Scope;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PACKAGE_SHARING_POLICY_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [Guid("06341b35-92fd-45ab-8fd8-59620cbdf9b2")]
        internal enum FABRIC_CONTAINER_ISOLATION_MODE : int
        {
            FABRIC_CONTAINER_ISOLATION_MODE_UNKNOWN = 0x0000,
            FABRIC_CONTAINER_ISOLATION_MODE_PROCESS = 0x0001,
            FABRIC_CONTAINER_ISOLATION_MODE_HYPER_V = 0x0002,
        }

        [Guid("06F434AA-2DE9-4C64-9697-92D02B4F07C3")]
        internal enum FABRIC_CONTAINER_NETWORK_TYPE : int
        {
            FABRIC_CONTAINER_NETWORK_TYPE_OTHER = 0x0000,
            FABRIC_CONTAINER_NETWORK_TYPE_OPEN = 0x0001,
            FABRIC_CONTAINER_NETWORK_TYPE_ISOLATED = 0x0002,
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_NETWORK_CONFIG_DESCRIPTION
        {
            public IntPtr OpenNetworkAssignedIp;
            public IntPtr OverlayNetworkResources;
            public IntPtr PortBindings;
            public IntPtr NodeId;
            public IntPtr NodeName;
            public IntPtr NodeIpAddress;
            public FABRIC_CONTAINER_NETWORK_TYPE NetworkType;
            public IntPtr Reserved;
         } 

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_DRIVER_OPTION_DESCRIPTION
        {
            public IntPtr Name;
            public IntPtr Value;
            public BOOLEAN IsEncrypted;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_DRIVER_OPTION_DESCRIPTION_EX1
        {
            public IntPtr Type;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_DRIVER_OPTION_DESCRIPTION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_VOLUME_DESCRIPTION
        {
            public IntPtr Source;
            public IntPtr Destination;
            public IntPtr Driver;
            public BOOLEAN IsReadOnly;
            public IntPtr DriverOpts;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_VOLUME_DESCRIPTION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_LABEL_DESCRIPTION
        {
            public IntPtr Name;
            public IntPtr Value;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_LABEL_DESCRIPTION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_LOG_CONFIG_DESCRIPTION
        {
            public IntPtr Driver;
            public IntPtr DriverOpts;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPOSITORY_CREDENTIAL_DESCRIPTION
        {
            public IntPtr AccountName;
            public IntPtr Password;
            public IntPtr Email;
            public BOOLEAN IsPasswordEncrypted;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_REPOSITORY_CREDENTIAL_DESCRIPTION_EX1
        {
            public IntPtr Type;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_HEALTH_CONFIG_DESCRIPTION
        {
            public BOOLEAN IncludeDockerHealthStatusInSystemHealthReport;
            public BOOLEAN RestartContainerOnUnhealthyDockerHealthStatus;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_UPDATE_ROUTE_ARGS
        {
            public IntPtr ContainerId;
            public IntPtr ContainerName;
            public IntPtr ApplicationId;
            public IntPtr ApplicationName;
            public FABRIC_CONTAINER_NETWORK_TYPE NetworkType;
            public IntPtr GatewayIpAddresses;
            public BOOLEAN AutoRemove;
            public BOOLEAN IsContainerRoot;
            public IntPtr CgroupName;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_DESCRIPTION
        {
            public IntPtr ApplicationName;
            public IntPtr ServiceName;
            public IntPtr ApplicationId;
            public IntPtr ContainerName;
            public IntPtr DeploymentFolder;
            public IntPtr NodeWorkFolder;
            public IntPtr AssignedIp;
            public IntPtr EntryPoint;
            public IntPtr HostName;
            public IntPtr GroupContainerName;
            public FABRIC_CONTAINER_ISOLATION_MODE IsolationMode;
            public IntPtr PortBindings;
            public IntPtr LogConfig;
            public IntPtr Volumes;
            public IntPtr DnsServers;
            public IntPtr SecurityOptions;
            public IntPtr RepositoryCredential;
            public IntPtr HealthConfig;
            public BOOLEAN AutoRemove;
            public BOOLEAN RunInteractive;
            public BOOLEAN IsContainerRoot;
            public IntPtr CodePackageName;
            public IntPtr ServicePackageActivationId;
            public IntPtr PartitionId;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_DESCRIPTION_EX1
        {
            public BOOLEAN UseDefaultRepositoryCredentials;
            public IntPtr Labels;
            public BOOLEAN RemoveServiceFabricRuntimeAccess;
            public IntPtr BindMounts;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_DESCRIPTION_EX2
        {
            public BOOLEAN UseTokenAuthenticationCredentials;
            public IntPtr Reserved;
        }
        
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_DESCRIPTION_EX3
        {
            public IntPtr ContainerNetworkConfigDescription;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PROCESS_DEBUG_PARAMETERS
        {
            public IntPtr ExePath;
            public IntPtr Arguments;
            public IntPtr LockFile;
            public IntPtr WorkingFolder;
            public IntPtr DebugParametersFile;
            public IntPtr EnvVars;
            public IntPtr ContainerEntryPoints;
            public IntPtr ContainerMountedVolumes;
            public IntPtr ContainerEnvironmentBlock;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PROCESS_DEBUG_PARAMETERS_EX1
        {
            public IntPtr ContainerLabels;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_RESOURCE_GOVERNANCE_POLICY_DESCRIPTION
        {
            public IntPtr CodePackageRef;
            public UInt32 MemoryInMB;
            public UInt32 MemorySwapInMB;
            public UInt32 MemoryReservationInMB;
            public UInt32 CpuShares;
            public UInt32 CpuPercent;
            public UInt32 MaximumIOps;
            public UInt32 MaximumIOBytesps;
            public UInt32 BlockIOWeight;
            public IntPtr CpusetCpus;
            public UInt64 NanoCpus;
            public UInt32 CpuQuota;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_RESOURCE_GOVERNANCE_POLICY_DESCRIPTION_EX1
        {
            public UInt64 DiskQuotaInMB;
            public UInt64 KernelMemoryInMB;
            public UInt64 ShmSizeInMB;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_SERVICE_PACKAGE_RESOURCE_GOVERNANCE_DESCRIPTION
        {
            public BOOLEAN IsGoverned;
            public UInt32 MemoryInMB;
            public Double CpuCores;
            public UInt32 NotUsed;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PROCESS_DESCRIPTION
        {
            public IntPtr ExePath;
            public IntPtr Arguments;
            public IntPtr StartInDirectory;
            public IntPtr EnvVars;
            public IntPtr AppDirectory;
            public IntPtr TempDirectory;
            public IntPtr WorkDirectory;
            public IntPtr LogDirectory;
            public BOOLEAN RedirectConsole;
            public IntPtr RedirectedConsoleFileNamePrefix;
            public Int32 ConsoleRedirectionFileRetentionCount;
            public Int32 ConsoleRedirectionFileMaxSizeInKb;
            public BOOLEAN ShowNoWindow;
            public BOOLEAN AllowChildProcessDetach;
            public BOOLEAN NotAttachedToJob;
            public IntPtr DebugParameters;
            public IntPtr ResourceGovernancePolicy;
            public IntPtr ServicePackageResourceGovernance;
            public IntPtr CgroupName;
            public BOOLEAN IsHostedServiceProcess;
            public IntPtr Reserved;
        }
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_PROCESS_DESCRIPTION_EX1
        {
            public IntPtr EncryptedEnvironmentVariables;
            public IntPtr Reserved;
        }
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_IMAGE_DESCRIPTION
        {
            public IntPtr ImageName;
            public IntPtr RepositoryCredential;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_IMAGE_DESCRIPTION_EX1
        {
            public BOOLEAN UseDefaultRepositoryCredentials;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_IMAGE_DESCRIPTION_EX2
        {
            public BOOLEAN UseTokenAuthenticationCredentials;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_IMAGE_DESCRIPTION_LIST
        {
            public UInt32  Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_ACTIVATION_ARGS
        {
            public BOOLEAN IsUserLocalSystem;
            public IntPtr AppHostId;
            public IntPtr NodeId;
            public IntPtr ContainerDescription;
            public IntPtr ProcessDescription;
            public IntPtr FabricBinPath;
            public IntPtr GatewayIpAddress;
            public IntPtr Reserved;
        }
        
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_ACTIVATION_ARGS_EX1
        {
            public IntPtr GatewayIpAddresses;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_DEACTIVATION_ARGS
        {
            public IntPtr ContainerName;
            public BOOLEAN ConfiguredForAutoRemove;
            public BOOLEAN IsContainerRoot;
            public IntPtr CgroupName;
            public BOOLEAN IsGracefulDeactivation;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_HOSTING_SETTINGS
        {
            public IntPtr SettingsMap;
            public IntPtr Reserved;
        }

        [Guid("98ef99cc-5e03-44a5-b32d-5f7313b3d59d")]
        internal enum FABRIC_CONTAINER_EVENT_TYPE : int
        {
            FABRIC_CONTAINER_EVENT_TYPE_NONE = 0x0000,
            FABRIC_CONTAINER_EVENT_TYPE_STOP = 0x0001,
            FABRIC_CONTAINER_EVENT_TYPE_DIE = 0x0002,
            FABRIC_CONTAINER_EVENT_TYPE_HEALTH = 0x0003
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_EVENT_DESCRIPTION
        {
            public FABRIC_CONTAINER_EVENT_TYPE EventType;
            public IntPtr ContainerId;
            public IntPtr ContainerName;
            public UInt64 TimeStampInSeconds;
            public BOOLEAN IsHealthy;
            public UInt32 ExitCode;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_EVENT_DESCRIPTION_LIST
        {
            public UInt32 Count;
            public IntPtr Items;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_EVENT_NOTIFICATION
        {
            public UInt64 SinceTime;
            public UInt64 UntilTime;
            public IntPtr EventList;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_API_EXECUTION_ARGS
        {
            public IntPtr ContainerName;
            public IntPtr HttpVerb;
            public IntPtr UriPath;
            public IntPtr ContentType;
            public IntPtr RequestBody;
            public IntPtr Reserved;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_CONTAINER_API_EXECUTION_RESPONSE
        {
            public UInt16 StatusCode;
            public IntPtr ContentType;
            public IntPtr ContentEncoding;
            public UInt32 ResponseBodyBufferSize;
            public IntPtr ResponseBody;
            public IntPtr Reserved;
        }

        //--------------------------------
        // Linux Structured Traces
        //--------------------------------
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ETW_TRACE_EVENT_DATA_DESCRIPTOR_LIST
        {
            public ulong Count;
            public IntPtr UserDataDescriptor;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_ETW_TRACE_EVENT_PAYLOAD
        {
            public IntPtr EventDescriptor;
            public FABRIC_ETW_TRACE_EVENT_DATA_DESCRIPTOR_LIST EventDataDescriptorList;
            public IntPtr Reserved;
        }

            //// ----------------------------------------------------------------------------
        //// Utility Conversion Methods

        #region utility conversion methods

        public static DateTime FromNativeFILETIME(NativeTypes.NativeFILETIME filetime)
        {
            UInt64 ticksLow = filetime.dwLowDateTime;
            UInt64 ticksHigh = filetime.dwHighDateTime;

            Int64 ticks = (Int64)((ticksHigh << 32) + ticksLow);

            return FromNativeTicks(ticks);
        }

        public static DateTime FromNativeTicks(Int64 ticks)
        {
            if (ticks >= DateTime.MaxValue.Ticks)
            {
                return DateTime.MaxValue;
            }
            else if (ticks <= DateTime.MinValue.Ticks)
            {
                return DateTime.MinValue;
            }
            else
            {
                return DateTime.FromFileTimeUtc(ticks);
            }
        }

        public static DateTime? FromNullableNativeFILETIME(NativeFILETIME filetime)
        {
            DateTime? result = null;

            if (!filetime.Equals(NativeTypes.MinNativeFILETIME))
            {
                result = NativeTypes.FromNativeFILETIME(filetime);
            }

            return result;
        }

        public static NativeTypes.NativeFILETIME ToNativeFILETIME(DateTime dateTime)
        {
            Int64 fileTimeUtc = ToNativeTicks(dateTime);

            NativeTypes.NativeFILETIME nativeFileTime = new NativeTypes.NativeFILETIME();
            nativeFileTime.dwLowDateTime = (UInt32)(fileTimeUtc & 0xFFFFFFFF);
            nativeFileTime.dwHighDateTime = (UInt32)(fileTimeUtc >> 32);

            return nativeFileTime;
        }

        public static Int64 ToNativeTicks(DateTime dateTime)
        {
            if (dateTime == DateTime.MaxValue)
            {
                return Int64.MaxValue;
            }
            else if (dateTime == DateTime.MinValue)
            {
                return 0;
            }
            else
            {
                return dateTime.ToFileTimeUtc();
            }
        }

        public static BOOLEAN ToBOOLEAN(bool flag)
        {
            return flag ? ((BOOLEAN)1) : ((BOOLEAN)0);
        }

        public static bool FromBOOLEAN(BOOLEAN flag)
        {
            return (flag == 1) ? true : false;
        }

        public static byte[] FromNativeBytes(IntPtr p, UInt32 size)
        {
            if (size == 0)
            {
                return EmptyByteArray;
            }
            else
            {
                ReleaseAssert.AssertIfNot(p != IntPtr.Zero, "ptr cannot be null if there is a size");

                var array = new byte[size];
                Marshal.Copy(p, array, 0, (int)size);
                return array;
            }
        }

        public static Tuple<uint, IntPtr> ToNativeBytes(PinCollection pin, byte[] data)
        {
            if (data == null)
            {
                return Tuple.Create((uint)0, IntPtr.Zero);
            }
            else
            {
                return Tuple.Create((uint)data.Length, pin.AddBlittable(data));
            }
        }

#if !INTERNAL_COMMON_ASSEMBLY
        public static Tuple<uint, IntPtr> ToNativeLoadMetrics(PinCollection pin, IList<System.Fabric.Description.ServiceLoadMetricDescription> metrics)
        {
            if (metrics.Count == 0)
            {
                return Tuple.Create((uint)0, IntPtr.Zero);
            }

            var metricsArray = new NativeTypes.FABRIC_SERVICE_LOAD_METRIC_DESCRIPTION[metrics.Count];
            for (int i = 0; i < metrics.Count; i++)
            {
                metrics[i].ToNative(pin, ref metricsArray[i]);
            }

            return Tuple.Create((uint)metrics.Count, pin.AddBlittable(metricsArray));
        }
#endif

        [SuppressMessage(FxCop.Category.Reliability, FxCop.Rule.RemoveCallsToGCKeepAlive, Justification = FxCop.Justification.EnsureNativeBuffersLifetime)]
        public static string FromNativeString(NativeCommon.IFabricStringResult result)
        {
            var s = Marshal.PtrToStringUni(result.get_String());
            GC.KeepAlive(result);
            return s;
        }

        [SuppressMessage(FxCop.Category.Reliability, "CA2000:DisposeObjectsBeforeLosingScope", Justification = "Caller is responsible for disposing.")]
        public static unsafe SecureString FromNativeToSecureString(NativeCommon.IFabricStringResult nativeResult)
        {
            var nativePtr = nativeResult.get_String();
            var length = GetNativeStringLength(nativePtr);
            var secureString = new SecureString((char*)nativePtr, length);
            secureString.MakeReadOnly();

            GC.KeepAlive(nativeResult);

            return secureString;
        }

        public static unsafe SecureString FromNativeToSecureString(IntPtr nativeString)
        {
            var length = GetNativeStringLength(nativeString);
            var secureString = new SecureString((char*)nativeString, length);

            secureString.MakeReadOnly();
            GC.KeepAlive(nativeString);

            return secureString;
        }

        public static string FromNativeString(IntPtr p)
        {
            return Marshal.PtrToStringUni(p);
        }

        public static string FromNativeStringPointer(IntPtr p)
        {
            return Marshal.PtrToStringUni(Marshal.ReadIntPtr(p));
        }

        public static IDictionary<string, string> FromNativeStringMap(NativeCommon.IFabricStringMapResult nativeResult)
        {
            var result = FromNativeStringPairList(nativeResult.get_Result());
            GC.KeepAlive(nativeResult);
            return result;
        }

        internal static IDictionary<string, string> FromNativeStringPairList(IntPtr nativePtr)
        {
            var result = new Dictionary<string, string>();

            if (nativePtr != IntPtr.Zero)
            {
                unsafe
                {
                    FABRIC_STRING_PAIR_LIST * pairList = (FABRIC_STRING_PAIR_LIST*)nativePtr;
                    for (var ix=0; ix<pairList->Count; ++ix)
                    {
                        FABRIC_STRING_PAIR * pair = (FABRIC_STRING_PAIR*)pairList->Items;
                        result.Add(
                            NativeTypes.FromNativeString(pair[ix].Name),
                            NativeTypes.FromNativeString(pair[ix].Value));
                    }
                }
            }

            return result;
        }

        internal static IntPtr ToNativeStringPairList(PinCollection pin, IDictionary<string, string> stringPairList)
        {
            if (stringPairList == null)
            {
                return IntPtr.Zero;
            }

            var nativeArray = new FABRIC_STRING_PAIR[stringPairList.Count];

            int idx = 0;
            foreach (var kvPair in stringPairList)
            {
                nativeArray[idx].Name = pin.AddBlittable(kvPair.Key);
                nativeArray[idx].Value = pin.AddBlittable(kvPair.Value);

                ++idx;
            }

            var nativeList = new FABRIC_STRING_PAIR_LIST
            {
                Count = stringPairList.Count,
                Items = pin.AddBlittable(nativeArray)
            };

            return pin.AddBlittable(nativeList);
        }

        public static Uri FromNativeUri(IntPtr p)
        {
            // TODO: 724168 - Native to Managed URI conversion needs context to determine URI kind
            var s = Marshal.PtrToStringUni(p);
            if (String.IsNullOrEmpty(s))
            {
                return null;
            }
            else
            {
                return new Uri(s);
            }
        }

        public static unsafe List<string> FromNativeStringList(FABRIC_STRING_LIST stringList)
        {
            var itemList = new List<string>();
            var nativeStringArray = (char**)stringList.Items;
            for (int i = 0; i < stringList.Count; ++i)
            {
                var nativeItemPtr = (IntPtr)(nativeStringArray + i);
                itemList.Add(NativeTypes.FromNativeStringPointer(nativeItemPtr));
            }

            return itemList;
        }

        public static unsafe List<string> FromNativeStringList(IntPtr nativePtr)
        {
            if(nativePtr == IntPtr.Zero)
            {
                return new List<string>();
            }

            var nativeStringList = (FABRIC_STRING_LIST*)nativePtr;

            return FromNativeStringList(*nativeStringList);
        }

        public static IntPtr ToNativeStringList(PinCollection pin, IList<string> stringList)
        {
            if (stringList == null)
            {
                return IntPtr.Zero;
            }

            var nativeArray = new IntPtr[stringList.Count];
            for (int i = 0; i < stringList.Count; ++i)
            {
                nativeArray[i] = pin.AddBlittable(stringList[i]);
            }

            var nativeList = new NativeTypes.FABRIC_STRING_LIST();
            nativeList.Count = (uint)stringList.Count;
            nativeList.Items = pin.AddBlittable(nativeArray);

            return pin.AddBlittable(nativeList);
        }

        public static IntPtr ToNativeStringPointerArray(PinCollection pin, IList<string> stringList)
        {
            if (stringList == null)
            {
                return IntPtr.Zero;
            }

            IntPtr[] nativeArray = new IntPtr[stringList.Count];
            for (int i = 0; i < stringList.Count; ++i)
            {
                nativeArray[i] = pin.AddBlittable(stringList[i]);
            }

            return pin.AddBlittable(nativeArray);
        }

        private static unsafe int GetNativeStringLength(IntPtr stringIntPtr)
        {
            char* charPtr = (char*)stringIntPtr;

            int length = 0;
            while (*charPtr++ != 0x0000)
            {
                length++;
            }

            return length;
        }

        public static NodeId FromNativeNodeId(NativeTypes.FABRIC_NODE_ID nativeNodeId)
        {
            return new NodeId(new BigInteger(nativeNodeId.High), new BigInteger(nativeNodeId.Low));
        }

        public static NativeTypes.FABRIC_NODE_ID ToNativeNodeId(NodeId nodeId)
        {
            NativeTypes.FABRIC_NODE_ID nativeNodeId = new NativeTypes.FABRIC_NODE_ID();

            try
            {
                nativeNodeId.High = (ulong)nodeId.High;
                nativeNodeId.Low = (ulong)nodeId.Low;
            }
            catch (OverflowException)
            {
                throw new InvalidOperationException(StringResources.Error_InvalidNodeId);
            }

            return nativeNodeId;
        }

        #endregion utility conversion methods

        #region managed performance counter

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_COUNTER_INITIALIZER
        {
            public UInt32 CounterId;
            public UInt32 BaseCounterId;
            public UInt32 CounterType;
            public IntPtr CounterName;
            public IntPtr CounterDescription;
        };

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct FABRIC_COUNTER_SET_INITIALIZER
        {
            public IntPtr CounterSetId;
            public IntPtr CounterSetName;
            public IntPtr CounterSetDescription;
            public UInt32 CounterSetInstanceType;
            public UInt32 NumCountersInSet;
            public IntPtr Counters;
        };

        #endregion
    }
}